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.
Arguments
- x
An OHLC object to be charted.
- type
- idx
A vector with the same length of
x. If passed it will replace the x-axis labels. Seevignette("charting")for more details.- title
- ...
Parameters passed into plotly::plot_ly
Details
The function uses various controlable options:
- talib.deficiency <logical>
FALSEby default. IfTRUEit uses colorblind-friendly colors.- talib.chart.dark <logical>
TRUEby default. IfFALSEit charting is done in light mode.- talib.chart.slider <logical>
FALSEby default. IfTRUEarangeslideris added to the chart.- talib.chart.slider.size <numeric>
0.05 by default. Controls the size of the
rangeslider.- talib.chart.legend <logical>
TRUEby default. IfFALSEthe chart comes without legends.- talib.chart.scale <numeric>
1 by default. Controls the scale of fonts.
See also
Other Charting:
indicator()
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
)
