Skip to content

abline for quantmod charts

2 messages · Hae Kyung Im, Jeff Ryan

#
Hi Jeff

I had to change the argument "on" to 1 for it to show the vertical
line (I have quantmod 0.3-8)
addTA(xts(TRUE,as.Date("2008-04-01")),on=1,col="#333333")


Now I wanted to make it easier to call including the call to a function:

addVLine = function(dtlist)
  {
    addTA(xts( rep(TRUE, NROW(dtlist)), dtlist), on=1, col="#333333")
  }

where dtlist is a vector with datetime type. But when the lines don't
show up. It does plot the vertical lines when I run the command
directly but not within the function. This is what I get on the
command line:
<chobTA object: addTA>


Do you know how to solve this?

Thanks
Haky
On Thu, Apr 30, 2009 at 4:16 PM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:
#
Hi Haky,

wrap addTA with plot().  It is a function of being able to use the
same function from the command line, and embedded in a chartSeries
call.  Internally there is a check to see where it originates from to
take a guess as to draw it immediately or not.

addVLine = function(dtlist)
 {
   plot(addTA(xts( rep(TRUE, NROW(dtlist)), dtlist), on=1, col="#333333"))
 }

HTH
Jeff
On Tue, May 5, 2009 at 12:55 PM, Hae Kyung Im <haky.im at gmail.com> wrote: