chart_dygraph | R Documentation |
Plot an interactive dygraphs candlestick plot with background shading for an OHLC time series in xts format.
chart_dygraph(ohlc, indic = NULL, ...)
ohlc |
An OHLC time series in xts format. |
indic |
A Boolean time series in xts format for
specifying the shading areas, with TRUE indicating "lightgreen" shading,
and FALSE indicating "antiquewhite" shading (the default is |
... |
Additional arguments to function |
The function chart_dygraph()
creates an interactive dygraphs
candlestick plot with background shading for an OHLC time series.
The function chart_dygraph()
uses plotting functions from the
package
dygraphs.
A dygraphs
plot object, and a dygraphs
plot produced as
a side effect.
# Plot an interactive dygraphs candlestick plot with background shading
ohlc <- rutils::etfenv$VTI
vwapv <- TTR::VWAP(price=quantmod::Ad(ohlc), volume=quantmod::Vo(ohlc), n=20)
ohlc <- cbind(ohlc[, c(1:3, 6)], vwapv)["2009-02/2009-04"]
rutils::chart_dygraph(ohlc, indic=(ohlc[, 4] > vwapv))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.