chart_dygraph: Plot an interactive _dygraphs_ candlestick plot with...

View source: R/rutils.R

chart_dygraphR Documentation

Plot an interactive dygraphs candlestick plot with background shading for an OHLC time series in xts format.

Description

Plot an interactive dygraphs candlestick plot with background shading for an OHLC time series in xts format.

Usage

chart_dygraph(ohlc, indic = NULL, ...)

Arguments

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 (default is NULL).

...

Additional arguments to function dygraphs::dygraph().

Details

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.

Value

A dygraphs plot object, and a dygraphs plot produced as a side effect.

Examples

# 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))

algoquant/rutils documentation built on April 18, 2024, 12:05 a.m.