[R-SIG-Finance] quantmod: adding many TAs in a function without constant replotting
Nicolas Chapados
nicolas.chapados at gmail.com
Tue Jan 12 02:36:35 CET 2010
Dear list,
I'm using quantmod to create some good-looking charts (many thanks to
the Jeff Ryan for this great package!), and I would like to wrap some
recipes within a function, as opposed to updating the chart
interactively. In particular, I want to add a bunch (a few dozen) of
TAs (using addTA) to a chart. However, since this is performed within
a function and not interactively, it is necessary, as per previous
posts to this list, to wrap each addTA call within a plot:
myplot <- function()
{
candleChart(prices)
plot(addTA(...))
plot(addTA(...))
...
}
However, since there is a lot of addTA in my code, this is EXTREMELY
slow. Is there a way to simply "accumulate" all the chobTA objects
returned by addTA into the chob returned by candleChart WITHOUT
replotting each time, and to simply do a final plot at the end? I
looked long and hard for previous posts on this topic, and tried
inspecting some of quantmod code as well, to no avail...
Any help greatly appreciated!
Best regards,
+ Nicolas Chapados
More information about the R-SIG-Finance
mailing list