RSI

0th

Percentile

Relative Strength Index

The Relative Strength Index (RSI) calculates a ratio of the recent upward price movements to the absolute price movement. Developed by J. Welles Wilder.

Keywords
ts
Usage
RSI(price, n = 14, maType, ...)
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.

Other arguments to be passed to the maType function in case (1) above.

Details

The RSI calculation is RSI = 100 - 100 / ( 1 + RS ), where RS is the smoothed ratio of 'average' gains over 'average' losses. The 'averages' aren't true averages, since they're divided by the value of n and not the number of periods in which there are gains/losses.

Value

A object of the same class as price or a vector (if try.xts fails) containing the RSI values.

Note

The RSI is usually interpreted as an overbought/oversold (over 70 / below 30) indicator. Divergence with price may also be useful. For example, if price is making new highs/lows, but RSI is not, it could indicate a reversal.

You can calculate a stochastic RSI by using the function stoch on RSI values.

References

The following site(s) were used to code/document this indicator: Relative Strength Index: http://www.fmlabs.com/reference/RSI.htm http://www.equis.com/Customer/Resources/TAAZ/?c=3&p=100 http://linnsoft.com/tour/techind/rsi.htm http://stockcharts.com/education/IndicatorAnalysis/indic_RSI.html Stochastic RSI: http://www.fmlabs.com/reference/StochRSI.htm http://stockcharts.com/education/IndicatorAnalysis/indic_stochRSI.html

See Also

See EMA, SMA, etc. for moving average options; and note Warning section. See CMO for a variation on RSI.

Aliases
  • RSI
Examples
library(TTR) # NOT RUN { data(ttrc) price <- ttrc[,"Close"] # Default case rsi <- RSI(price) # Case of one 'maType' for both MAs rsiMA1 <- RSI(price, n=14, maType="WMA", wts=ttrc[,"Volume"]) # Case of two different 'maType's for both MAs rsiMA2 <- RSI(price, n=14, maType=list(maUp=list(EMA,ratio=1/5), maDown=list(WMA,wts=1:10))) # }
Documentation reproduced from package TTR, version 0.23-1, License: GPL-2

Community examples

Looks like there are no examples yet.