Skip to content
Prev 4619 / 15274 Next

quantmod Charting

Some details on how quantmod/chartSeries works are in order:

Looping (or calling) outside of the .GlobalEnv is tricky.  To make
chartSeries and addTA stuff  interactively they do a lot of internal
checking and manipulation.

Calling addTA (or add***) from a non-global env will cause the plot
step to be skipped. To force plotting you need to wrap the add calls
in plot()

Secondly, opening a device first, then looping over these values will
cause a full screen redraw at each iteration -- usually what you want.
 In a pdf() this causes a new plot to be printed.  So if you call
addTA() 10 times on a chart, you'll have a total of 11 charts/pages.

The best way (at present) to manage this is to simply dump the final
chart (after all the additions) to a pdf using:

?saveChart or ?dev.copy2pdf

There are some further nuances to this of course, but that should get
you at least in the right direction.

HTH
Jeff
On Thu, Jul 23, 2009 at 10:53 AM, Brian G. Peterson<brian at braverock.com> wrote: