Learn R Programming

cryptoQuotes (version 1.3.4)

macd: Chart the Moving Average Convergence Divergence (MACD) indicator

Description

[Experimental]

A high-level plotly::plot_ly()- and plotly::add_lines()-function that interacts with the TTR::MACD()-function. The function adds subchart with a TTR::MACD()-indicator.

Usage

macd(
 nFast   = 12,
 nSlow   = 26,
 nSig    = 9,
 maType  = "SMA",
 percent = TRUE,
 ...
)

Value

An invisible

plotly::plot_ly()-object.

Arguments

nFast

Number of periods for fast moving average.

nSlow

Number of periods for slow moving average.

nSig

Number of periods for signal moving average.

maType

Either:

  1. A function or a string naming the function to be called.

  2. A list with the first component like (1) above, and additional parameters specified as named components. See Examples.

percent

logical; if TRUE, the percentage difference between the fast and slow moving averages is returned, otherwise the difference between the respective averages is returned.

...

For internal use. Please ignore.

Author

Serkan Korkmaz

See Also

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

Other subchart indicators: add_event(), fgi(), lsr(), rsi(), smi(), volume()

Other momentum indicators: rsi(), smi()

Examples

Run this code
# script start;

# 1) charting weekly
# BTC using candlesticks
# and indicators
cryptoQuotes::chart(
  ticker = BTC,
  main = cryptoQuotes::kline(),
  sub = list(
    cryptoQuotes::volume(),
    cryptoQuotes::macd()
  ),
  indicator = list(
    cryptoQuotes::bollinger_bands(),
    cryptoQuotes::sma(),
    cryptoQuotes::alma()
  ),
  options = list(
    dark = TRUE,
    deficiency = FALSE
  )
)

# script end;

Run the code above in your browser using DataLab