The Relative Strength Index (RSI) calculates a ratio of the recent upward price movements to the absolute price movement. Developed by J. Welles Wilder.
Price series that is coercible to xts or matrix.
Number of periods for moving averages.
Other arguments to be passed to the
The RSI calculation is
RSI = 100 - 100 / ( 1 + RS ), where
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.
A object of the same class as
price or a vector (if
try.xts fails) containing the RSI values.
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
on RSI values.
The following site(s) were used to code/document this
Relative Strength Index:
1 2 3 4 5 6 7 8 9 10 11 12
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.