Learn R Programming

TTR (version 0.13-1)

RSI: Relative Strength Index

Description

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

Usage

RSI(price, ma.up=list("EMA", n=14, wilder=TRUE), ma.down=ma.up)

Arguments

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.

Value

  • A vector containing the RSI values.

Details

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.

References

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 Also

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

Examples

Run this code
data(ttrc)
  rsi <- RSI(ttrc[,"Close"])

Run the code above in your browser using DataLab