RSI {TTR} | R Documentation |
The Relative Strength Index (RSI) calculates a ratio of the recent upward price movements to the absolute price movement. Developed by J. Welles Wilder.
RSI(price, ma.up=list("EMA", n=14, wilder=TRUE), ma.down=ma.up)
price |
Price series to use. |
ma.up |
A list whose first component is a string containing the upward price movement moving average function name; additional parameters may also be specified as named components. |
ma.down |
Similar to ma.up , but for the downward price movement moving average. |
The RSI calculation is RSI = 100 - 100 / ( 1 + RS )
, where RS
is the smoothed
ratio of ‘average’ gains over ‘average’ losses. The ‘average’ aren't true
averages, since they're divided by the value of n
not the number of gain/loss periods.
A vector 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 stochastic
on
RSI values.
Josh Ulrich
The following site(s) were used to code/document this indicator:
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
See EMA
, SMA
, etc. for moving average options; and note
Warning section. See CMO
for a variation on RSI.
data(ttrc) rsi <- RSI(ttrc[,"Close"])