Skip to contents

[Experimental]

A high-level plotly::add_lines()-wrapper function that interacts with TTR's moving average family of functions. The function adds moving average indicators to the main chart().

Usage

sma(
 price  = "close",
 n      = 10,
 ...
)

Arguments

price

A character-vector of length 1. "close" by default. The name of the vector to passed into TTR::SMA.

n

Number of periods to average over. Must be between 1 and nrow(x), inclusive.

...

For internal use. Please ignore.

Value

A plotly::plot_ly()-object

See also

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

Other moving average indicators: alma(), dema(), ema(), evwma(), hma(), vwap(), wma(), zlema()

Other main chart indicators: add_event(), alma(), bollinger_bands(), dema(), ema(), evwma(), hma(), vwap(), wma(), zlema()

Author

Serkan Korkmaz

Examples

# script start;

cryptoQuotes::chart(
  ticker = BTC,
  main   = kline(),
  indicator = list(
    cryptoQuotes::ema(n = 7),
    cryptoQuotes::sma(n = 14),
    cryptoQuotes::wma(n = 21)
  )
)
# script end;