Skip to contents

[Experimental]

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

Usage

smi(
 nFastK = 14,
 nFastD = 3,
 nSlowD = 3,
 maType,
 bounded = TRUE,
 smooth = 1,
 upper_limit = 40,
 lower_limit = -40,
 color = "#4682b4",
 ...
)

Arguments

nFastK

Number of periods for fast %K (i.e. the number of past periods to use).

nFastD

Number of periods for fast %D (i.e. the number smoothing periods to apply to fast %K).

nSlowD

Number of periods for slow %D (i.e. the number smoothing periods to apply to fast %D).

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.

bounded

Logical, should current period's values be used in the calculation?

smooth

Number of internal smoothing periods to be applied before calculating FastK. See Details.

upper_limit

A numeric-vector of length 1. 40 by default. Sets the upper limit of the TTR::SMI.

lower_limit

A numeric-vector of length 1. -40 by default. Sets the lower limit of the TTR::SMI.

color

A character-vector of length 1. "#4682b4" by default.

...

For internal use. Please ignore.

Value

An invisible plotly::plot_ly()-object.

See also

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

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

Other momentum indicators: macd(), rsi()

Author

Serkan Korkmaz

Examples

# 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;