Skip to contents

The chart-function is a generic S3 function for charting OHLC series as either candlesticks or 'traditional' OHLC-bars. The function is a high-level wrapper of plotly::plot_ly with predefined OHLC values based on the input series.

Usage

chart(x, type = "candlestick", idx = NULL, title, ...)

Arguments

x

An OHLC object to be charted.

type

A character of length 1. Either candlestick or ohlc.

idx

A vector with the same length of x. If passed it will replace the x-axis labels. See vignette("charting") for more details.

title

An optional character vector of length 1.

...

Parameters passed into plotly::plot_ly

Details

The function uses various controlable options:

talib.deficiency <logical>

FALSE by default. If TRUE it uses colorblind-friendly colors.

talib.chart.dark <logical>

TRUE by default. If FALSE it charting is done in light mode.

talib.chart.slider <logical>

FALSE by default. If TRUE a rangeslider is added to the chart.

talib.chart.slider.size <numeric>

0.05 by default. Controls the size of the rangeslider.

talib.chart.legend <logical>

TRUE by default. If FALSE the chart comes without legends.

talib.chart.scale <numeric>

1 by default. Controls the scale of fonts.

See also

Other Charting: indicator()

Author

Serkan Korkmaz

Examples

## charting in {talib}
## using {plotly}
x <- talib::BTC

## candlestick chart
## of BTC
talib::chart(x)
## adding indicators ## via indicator() { ## simple moving ## averages talib::indicator( FUN = talib::SMA, n = 7 ) talib::indicator( FUN = talib::SMA, n = 14 ) talib::indicator( FUN = talib::SMA, n = 21 ) ## MACD talib::indicator( FUN = talib::MACD ) ## OBV talib::indicator( FUN = talib::OBV ) } #> Warning: Ignoring 33 observations #> Warning: Ignoring 33 observations
## chart indicators ## without candlesticks ## by resetting the previous ## chart talib::chart() ## chart indicator talib::indicator( FUN = stochastic, data = x )