[R] abline(h=whatever) not working in candleChart() (in quantmod)?

2010-11-21 Thread David L. Van Brunt, Ph.D.
Hello, all--

I am having some fun playing with the graphing in quantmod-- very nice! I am
writing a function to calculate (and hopefully plot) support and resistance
lines, but the usual plot call of abline(h=value) does not seem to work.
Here's my code:

require(quantmod)
AAPL-getYahooData(AAPL)
candleChart(AAPL,subset=last 3 months,theme=white)
addMACD()
abline(h=290,col=red)


The same sequence works fine if I'm just using a plain vanilla plot call,
however.

What am I missing? Do I need to call the line as a technical study using
addTA? Not sure how to make a straight line constant doing that...

I'm sure it should be obvious, since my searching on google hasn't turned up
anything. So I'm getting ready for a face-palm moment if anyone can point
me in the right direction!

---
David L. Van Brunt, Ph.D.
mailto:dlvanbr...@gmail.com


On Sun, Nov 21, 2010 at 10:29 AM, David Winsemius dwinsem...@comcast.netwrote:

 stop() throws an error but the side effect is to pop out of whatever
 environment you may be in and return to the top-level. I thought that was
 what you wanted. If not,  then please produce a better problem description
 with code as requested in the posting guide.


 On Nov 21, 2010, at 10:12 AM, madr wrote:


 I try to use stop(), but i get:
 Error in eval.with.vis(expr, envir, enclos) :
 --
 View this message in context: http://r.789695.n4.nabble.com/


 And learn to include context.


 --

 David Winsemius, MD
 West Hartford, CT

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] abline(h=whatever) not working in candleChart() (in quantmod)?

2010-11-21 Thread David Winsemius


On Nov 21, 2010, at 10:50 AM, David L. Van Brunt, Ph.D. wrote:


Hello, all--

I am having some fun playing with the graphing in quantmod-- very  
nice! I am
writing a function to calculate (and hopefully plot) support and  
resistance
lines, but the usual plot call of abline(h=value) does not seem to  
work.

Here's my code:

require(quantmod)
AAPL-getYahooData(AAPL)
candleChart(AAPL,subset=last 3 months,theme=white)
addMACD()
abline(h=290,col=red)


Looks to me that chartSeries is an S4 function that works on objects  
of class chob. So try seeing if these widen your perspective :


?chob-class
?TA
?newTA




The same sequence works fine if I'm just using a plain vanilla  
plot call,

however.

What am I missing? Do I need to call the line as a technical study  
using

addTA?


That's what it looks like from here.


Not sure how to make a straight line constant doing that...

I'm sure it should be obvious, since my searching on google hasn't  
turned up
anything. So I'm getting ready for a face-palm moment if anyone  
can point

me in the right direction!

---
David L. Van Brunt, Ph.D.
mailto:dlvanbr...@gmail.com


trimmed the irrelevant material from another posting

.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.