Skip to contents

[Experimental]

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

Usage

rsi(
 price       = "close",
 n           = 14,
 maType      = "SMA",
 upper_limit = 80,
 lower_limit = 20,
 color       = '#4682b4',
 ...
)

Arguments

price

Price series that is coercible to xts or matrix.

n

Number of periods for moving averages.

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.

upper_limit

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

lower_limit

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

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(), sma(), smi(), volume(), vwap(), wma(), zlema()

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

Other momentum indicators: macd(), smi()

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;