The Relative Strength Index (RSI) is a financial technical analysis momentum oscillator measuring the velocity and magnitude of directional price movement by comparing upward and downward close-to-close movements.
Momentum measures the rate of the rise or fall in stock price. Is the momentum increasing in the "up" direction, or is the momentum increasing in the "down" direction.
A simple way to picture momentum: Imagine a ball rolling down a hill. It starts off pretty slow and then as it gets further down the hill it picks up momentum and starts rolling faster.
The RSI was developed by J. Welles Wilder and published in Commodities magazine (now called Futures magazine) in June 1978, and in his New Concepts in Technical Trading Systems the same year.
Note that the term relative strength also refers to the strength of a security in relation to its sector or the overall market. For instance, XYZ might rise 2% when S&P 500 rises 1%. This is sometimes called comparative relative strength to avoid confusion. It's unrelated to the Relative Strength Index described here.
Calculation :
For each day an upward change (U) or downward change (D) is calculated. "Up" days are characterized by the daily close being higher than yesterday's daily close, i.e.:
U = closetoday − closeyesterday
D = 0
Conversely, a down day is characterized by the close being lower than the previous day's (note that D is nonetheless a positive number),
U = 0
D = closeyesterday − closetoday
If today's close is the same as yesterday's, both U and D are zero. An average for U is calculated with an exponential moving average using a given N-days smoothing factor, and likewise for D. The ratio of those averages is the Relative Strength,
RS = { EMA[N] of U / EMA[N] of D }
This is converted to a Relative Strength Index between 0 and 100,
RSI = 100 - 100 x { 1 / 1 + RS }
This can be rewritten as follows to emphasise the way RSI expresses the up as a proportion of the total up and down (averages in each case),
RSI = 100 x { EMA[N]of U / (EMA[N]of U) + (EMA[N]of D) }
The EMA, in theory, uses an infinite amount of past data. It's necessary either to go back far enough, or alternately at the start of data begin with a simple average of N days instead,
AvgU{initial} = { U1 + U2 + ... + UN } / N }
and then continue from there with the usual EMA formula,
AvgU{today} = a x U today + (1-a) x AvgU yesterday
Wilder recommended a smoothing period of 14. This is by his reckoning of EMA smoothing, ie. α=1/14 or N=27.
Wilder posited that when price moves up very rapidly, at some point it is considered overbought. Likewise, when price falls very rapidly, at some point it is considered oversold. In either case, Wilder felt a reaction or reversal is imminent. The slope of the RSI is directly proportional to the velocity of the move. The distance traveled by the RSI is proportional to the magnitude of the move.
As a result, Wilder believed that tops and bottoms are indicated when RSI goes above 70 or drops below 30. Traditionally, RSI readings greater than the 70 level are considered to be in overbought territory, and RSI readings lower than the 30 level are considered to be in oversold territory. In between the 30 and 70 level is considered neutral.
Wilder further believed that divergence between RSI and price action is a very strong indication that a market turning point is imminent. Bearish divergence occurs when price makes a new high but the RSI makes a lower high, thus failing to confirm. Bullish divergence occurs when price makes a new low but RSI makes a higher low.
Wilder thought that "failure swings" above 70 and below 30 on the RSI are strong indications of market reversals. For example, assume the RSI hits 76, pulls back to 72, then rises to 77. If it falls below 72, Wilder would consider this a "failure swing" above 70.
by J. Welles Wilder