chart {cryptoQuotes}R Documentation

Build interactive financial charts

Description

[Experimental]

chart() creates interactive financial charts using plotly::plot_ly() as backend. It's a high-level function which collects and structures the passed chart elements.

Usage

chart(
  ticker,
  main = kline(),
  sub = list(volume()),
  indicator = list(bollinger_bands()),
  event_data = NULL,
  options = list()
)

Arguments

ticker

A xts::xts()-object with Open, High, Low, Close and Volume columns.

main

A plotly::plot_ly()-object wrapped in rlang::expr(). kline() by default.

sub

An optional list of plotly::plot_ly()-object(s) wrapped in rlang::expr().

indicator

An optional list of plotly::plot_ly()-object(s) wrapped in rlang::expr().

event_data

An optional data.frame with event line(s) to be added to the chart(). See add_event() for more details.

options

An optional list of chart()-options. See details below.

Details

Options

Value

Returns a plotly::plot_ly() object.

Author(s)

Serkan Korkmaz

See Also

Other chart indicators: add_event(), alma(), bollinger_bands(), dema(), ema(), evwma(), fgi(), hma(), lsr(), macd(), rsi(), sma(), volume(), vwap(), wma(), zlema()

Other price charts: kline(), ohlc()

Examples

# script: scr_charting
# date: 2023-10-25
# author: Serkan Korkmaz, serkor1@duck.com
# objective: Charting in general
# script start;

## charting the klines
## with indicators as
## subcharts
chart(
  ticker     = BTC,
  main       = kline(),
  sub        = list(
    volume(),
    macd()
  ),
  indicator = list(
    bollinger_bands(),
    sma(),
    alma()
  ),
  options = list(
    dark = TRUE,
    deficiency = FALSE
  )
)

## charting the MACD-indicator
## with klines as subcharts
chart(
  ticker     = BTC,
  main       = macd(),
  sub        = list(
    volume(),
    kline()
  ),
  indicator = list(
    bollinger_bands(),
    sma()
  ),
  options = list(
    dark = TRUE,
    deficiency = FALSE
  )
)

# script end;

[Package cryptoQuotes version 1.3.0 Index]