David L. Van Brunt, Ph.D.
2010-Nov-21 15:50 UTC
[R] abline(h=whatever) not working in candleChart() (in quantmod)?
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:dlvanbrunt@gmail.com On Sun, Nov 21, 2010 at 10:29 AM, David Winsemius <dwinsemius@comcast.net>wrote:> 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]]
David Winsemius
2010-Nov-21 19:56 UTC
[R] abline(h=whatever) not working in candleChart() (in quantmod)?
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:dlvanbrunt at gmail.com >trimmed the irrelevant material from another posting> .David Winsemius, MD West Hartford, CT
Possibly Parallel Threads
- object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found
- Working with quantmod chartSeries and plot.zoo
- Adjusting OHCL data via quantmod
- Quantmod abline and axis configuration
- quantmod getOptionChain Not Work