Relative Strength Index Formula: RSI Explained
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
The Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements, with the formula: RSI = 100 – [100 / (1 + RS)], where RS is the average gain over a period divided by the average loss over the same period. You enter a series of closing prices (typically 14 periods) and the calculator returns a value between 0 and 100, with readings above 70 often considered overbought and below 30 oversold.
Formula
The standard RSI formula, developed by J. Welles Wilder in 1978, is:
RSI = 100 – [100 / (1 + RS)]
Where:
- RS = Average Gain / Average Loss over the lookback period (usually 14 periods).
- Average Gain = sum of all upward price changes over the period, divided by the period length.
- Average Loss = sum of all downward price changes (as positive numbers) over the period, divided by the period length.
If the average loss is zero, RSI is set to 100 by convention (because price only moved up). The formula produces a value from 0 to 100. Wilder’s original method uses a smoothed average (an exponential moving average) for subsequent periods, but the simple average version is common for manual calculation and is what most charting platforms use for the first value.
Worked Example
Using the default closing prices from the calculator above (14 periods):
- List the 14 price changes: +0.25, –0.06, +0.54, –0.72, +0.50, +0.27, +0.32, +0.42, +0.24, –0.19, +0.14, –0.42, +0.67, +0.00.
- Separate gains and losses. Gains: 0.25, 0.54, 0.50, 0.27, 0.32, 0.42, 0.24, 0.14, 0.67. Losses (as positive): 0.06, 0.72, 0.19, 0.42, 0.00 (zero is neither gain nor loss).
- Average gain = (0.25+0.54+0.50+0.27+0.32+0.42+0.24+0.14+0.67) / 14 = 3.35 / 14 = 0.2393.
- Average loss = (0.06+0.72+0.19+0.42) / 14 = 1.39 / 14 = 0.0993.
- RS = 0.2393 / 0.0993 = 2.410.
- RSI = 100 – [100 / (1 + 2.410)] = 100 – (100 / 3.410) = 100 – 29.33 = 70.67.
The calculator rounds to 70.67, which is just above the 70 overbought threshold.
How to Read RSI Values
RSI oscillates between 0 and 100. Traditional interpretations:
- Above 70: Overbought – price may be due for a pullback or consolidation.
- Below 30: Oversold – price may be due for a bounce or rally.
- 50 level: Neutral – gains and losses are roughly equal.
- Divergence: Price makes a new high but RSI makes a lower high (bearish divergence), or price makes a new low but RSI makes a higher low (bullish divergence) – often signals a potential reversal.
In strong uptrends, RSI can stay above 70 for extended periods; in strong downtrends, it can stay below 30. So the 70/30 thresholds are guidelines, not hard rules. Many traders adjust them to 80/20 in trending markets or use shorter periods (e.g., 9) for more sensitivity.
Choosing the Lookback Period
The default period is 14, as Wilder suggested. Shorter periods (e.g., 7 or 9) make RSI more volatile – it crosses 70 and 30 more often, generating more signals but with more false positives. Longer periods (e.g., 21 or 28) smooth the oscillator, giving fewer, more reliable signals. Day traders often use 5 or 9; swing traders commonly use 14; long-term investors may use 20 or more. The best period depends on your trading style and the asset’s volatility. You can test different periods on historical data to see which produces the most consistent signals for your strategy.
Common Mistakes and Misconceptions
One frequent error is using closing prices only versus intraday highs/lows – RSI is typically calculated on closing prices, but some traders use other price points (e.g., typical price) for different insights. Another mistake is ignoring the smoothing method: Wilder’s original RSI uses a smoothed average (an exponential moving average) for periods after the first, which gives different values than a simple average. Most charting platforms use Wilder’s smoothing by default. Also, a common misconception is that RSI > 70 means “sell� and < 30 means “buy� – in reality, overbought can stay overbought, and oversold can stay oversold. RSI is a probability tool, not a guarantee. Finally, be careful with zero average loss: if all price changes are positive, RSI is 100, which can mislead if the period is very short.
Limits of the Formula
RSI is a lagging indicator – it uses past prices, so it reacts after the move has started. It does not predict future prices; it only describes current momentum. In choppy, sideways markets, RSI can give many false signals. It also does not account for volume, volatility, or fundamental factors. RSI works best in ranging markets and is less reliable in strong trends unless you adjust thresholds. For a more complete picture, combine RSI with other indicators like moving averages, MACD, or support/resistance levels. Also note that RSI is symmetrical: a reading of 70 does not mean the same as 30 in terms of probability – the distribution of RSI values is not uniform, and extreme readings are rarer.
Frequently Asked Questions
What is the exact RSI formula?
RSI = 100 – (100 / (1 + RS)), where RS = average gain over the period / average loss over the period. For a 14-period RSI, you sum the gains over the last 14 price changes, divide by 14, sum the losses (as positive numbers) over the last 14, divide by 14, then divide the average gain by the average loss to get RS.
How is RSI calculated step by step?
First, compute the price change for each period (close – previous close). Second, separate gains (positive changes) and losses (negative changes, taken as absolute values). Third, average the gains and average the losses over the chosen period. Fourth, divide average gain by average loss to get RS. Finally, plug RS into the formula: 100 – (100 / (1 + RS)). If average loss is zero, RSI is 100.
What is Wilder’s smoothing in RSI?
Wilder’s original method uses a smoothed moving average: for the first RSI value, you use the simple average of gains and losses over the initial period. For subsequent periods, you update the average gain as: previous average gain × (period – 1) + current gain, all divided by period. This gives more weight to recent data and is what most charting software uses by default.
Why is RSI 14 the default?
Wilder introduced the 14-period RSI in his 1978 book “New Concepts in Technical Trading Systems.� He found that 14 periods worked well for daily charts. It has since become the industry standard, though traders often adjust it for different timeframes or assets.
Can RSI go above 100 or below 0?
No. The formula mathematically caps RSI between 0 and 100. If average loss is zero, RSI = 100. If average gain is zero, RSI = 0. In practice, you’ll rarely see exactly 0 or 100 because prices almost always have some mixed movement.
Does RSI work for all assets?
RSI works on any asset with price data – stocks, forex, crypto, commodities, and indices. However, its effectiveness varies with volatility and trendiness. Highly volatile assets may hit overbought/oversold more often, while strongly trending assets can stay in extreme zones for long periods. Always test RSI settings on the specific asset you trade.
Related
Formula used
in list | Closing prices | - | 44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08, 45.89, 46.03, 45.61, 46.28, 46.28 | 0 out rsi | RSI (14) | - | 100 - (100 / (1 + (mean(maxl(list[1:]-list[0:-1],0)) / mean(maxl(list[0:-1]-list[1:],0))))) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.