[R-SIG-Finance] Using abline with chartSeries
Joshua Ulrich
josh.m.ulrich at gmail.com
Sun Apr 8 04:39:44 CEST 2012
Worik,
On Sat, Apr 7, 2012 at 9:10 PM, Worik Stanton <worik.stanton at gmail.com> wrote:
> Friends
>
> I would like to be able to draw vertical lines on a chart resulting from
> chartSeries.
>
> I can draw horrizontal lines but they do not apear in the correct place.
>
> In the following example I draw a dotted white horizontal line, but not
> where I asked for it, and I get no vertical line using either of the two
> methods. I cannot find an answer via Google. I am stumped
>
Use rseek.org instead of Google (it provides a custom Google search).
The answer to your question is the first result under "support lists"
when you search for "chartseries vertical line".
chartSeries(IBM.m)
addTA(.xts(TRUE,.index(IBM.m)[24]), on=1)
> library(quantstrat)
> getSymbols("IBM")
> IBM.m <- to.monthly(IBM)
> chartSeries(IBM.m)
> abline(h=140, lty=2, col="white")
> QQ <- index(IBM.m[24,])
> abline(v=QQ, col="white", lty=2)
> abline(v=.index(IBM.m[24,]), col="white", lty=2)
>
Best,
--
Joshua Ulrich | FOSS Trading: www.fosstrading.com
R/Finance 2012: Applied Finance with R
www.RinFinance.com
More information about the R-SIG-Finance
mailing list