[R-SIG-Finance] abline for quantmod charts
jeff.a.ryan at gmail.com
Tue May 5 20:14:30 CEST 2009
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"))
On Tue, May 5, 2009 at 12:55 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
> Hi Jeff
> I had to change the argument "on" to 1 for it to show the vertical
> line (I have quantmod 0.3-8)
> 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?
> On Thu, Apr 30, 2009 at 4:16 PM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:
>> Hi Hae,
>> The best way to do this at the moment is with addTA:
>> You'll notice that it draws a thick line (region). This is usually
>> more useful than just a line on quantmod charts, as the spacing is
>> between observations is padded.
>> I will at some point be adding access for primitive graphics function
>> to the whole charting process, but for now this should do what you
>> On Thu, Apr 30, 2009 at 3:56 PM, Hae Kyung Im <haky.im at gmail.com> wrote:
>>> I was trying to add vertical lines to a quantmod plot using
>>> abline( v = somdatetime ) like in the following example
>>>  "YHOO"
>>>> abline( v=as.POSIXct("2008-04-01","%Y-%m-%d") )
>>> But nothing shows up on the chart.
>>> Any ideas on how to do this?
>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>> -- Subscriber-posting only.
>>> -- If you want to post, subscribe first.
>> Jeffrey Ryan
>> jeffrey.ryan at insightalgo.com
>> ia: insight algorithmics
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
More information about the R-SIG-Finance