Learn › Indicators

Relative Strength Index (RSI): Calculation, Settings and How Traders Use It

The Relative Strength Index, published by J. Welles Wilder in 1978 alongside ATR and ADX, is one of the most widely used momentum indicators. It compresses recent price changes into a single number between 0 and 100 that describes how strongly price has been rising compared with how strongly it has been falling. Because it is bounded, it is easy to read at a glance — and easy to misread. This guide explains exactly how RSI is calculated, what the common settings change, and how to turn RSI ideas into rules that can be tested.

The calculation step by step

RSI looks only at closing prices. For each bar it computes the change from the previous close and splits it into a gain or a loss:

  • If the close is higher than the previous close, the gain is the difference and the loss is 0.
  • If the close is lower, the loss is the absolute difference and the gain is 0.

The gains and losses are then averaged over a lookback period, 14 bars by default. Wilder used his own smoothing method (often called RMA), the same one he used for ATR:

AvgGaintoday = (AvgGainyesterday × (n − 1) + Gaintoday) / n

and the same formula for losses. The ratio of the two is the relative strength, RS = AvgGain / AvgLoss, and the index converts it to a 0–100 scale:

RSI = 100 − 100 / (1 + RS)

If average gains and average losses are equal, RS is 1 and RSI is 50. If there have been no losses at all, RSI approaches 100; if there have been no gains, it approaches 0.

A small worked example

Suppose that over the last 14 bars the smoothed average gain is 1.20 and the smoothed average loss is 0.80. RS = 1.20 / 0.80 = 1.5, so RSI = 100 − 100 / 2.5 = 60. Now imagine the next bar closes 2.00 higher. With n = 14 the new average gain becomes (1.20 × 13 + 2.00) / 14 ≈ 1.257 and the average loss becomes (0.80 × 13 + 0) / 14 ≈ 0.743. RS rises to about 1.69 and RSI to about 62.9. One strong bar moved RSI by roughly three points: the smoothing makes RSI responsive but not jumpy.

Why different platforms show different values

Two charts can show different RSI values for the same instrument and period. The usual reasons are:

  • Smoothing method. Some tools use a simple or exponential moving average of gains and losses instead of Wilder's RMA. The results converge in direction but differ in level.
  • Warm-up. Wilder's smoothing depends on every earlier bar. A chart that loads 200 bars of history and one that loads 5,000 bars can show slightly different values for the latest bar until the effect of the starting point fades.
  • Price source and session. Using a different close (for example a mark price versus a last-traded price on a derivatives exchange, or a session that ends at a different time) changes every input.

For automated strategies, the safest approach is to compute RSI with the same method in backtesting and live trading, and to load enough history before the first signal that warm-up effects are negligible.

What the period changes

A shorter period, such as 7, makes RSI react quickly and reach extreme readings more often. A longer period, such as 21 or 28, makes it smoother and keeps it closer to 50. Neither is better in general: the period simply decides what “recent” means. A 14-period RSI on a one-hour chart describes momentum over roughly the last 14 hours; the same setting on a daily chart covers almost three weeks of trading.

Overbought and oversold — what the levels actually mean

The classic levels are 70 and 30. Above 70, RSI is called “overbought”; below 30, “oversold”. These labels are often misunderstood. An RSI of 75 does not mean price must fall. It means that recent gains have been much larger than recent losses. In a strong uptrend, that can stay true for a long time, and RSI can remain above 70 while price keeps rising.

A more useful reading is that extreme RSI values describe stretched short-term momentum. Whether a stretched market tends to snap back or keep going depends on the instrument, the timeframe and the market regime — which is exactly what a backtest should measure rather than assume.

Three common ways RSI is used

1. Mean reversion in ranges

In sideways markets, traders buy when RSI drops below an oversold level and exit when it returns to 50 or rises above an overbought level. This works best when there is no strong trend; in a trend, the oversold signals keep firing as price falls further.

2. Momentum confirmation in trends

Trend-following systems often use RSI the other way round: they only take long breakouts when RSI is above a threshold such as 55, confirming that momentum supports the move, and only take shorts when RSI is below 45. Here a high RSI is a reason to participate, not a reason to sell.

3. Regime ranges

A widely cited observation is that in uptrends RSI tends to oscillate roughly between 40 and 80, and in downtrends roughly between 20 and 60. Traders use this to classify the regime: if RSI repeatedly fails to drop below 40, the market is behaving like an uptrend. These ranges are rules of thumb, not constants, and should be checked on the instruments you trade.

Divergence

A bearish divergence occurs when price makes a higher high but RSI makes a lower high; a bullish divergence is the mirror image. Divergence says that the latest push in price came with less momentum than the previous one. It is a warning sign, not a timing signal: divergences can persist through several further highs before any reversal, and many never lead to one. If you want to test divergence, define it precisely — for example, using confirmed swing highs a fixed number of bars apart — so that it cannot be identified with hindsight.

Turning RSI into testable rules

Vague ideas such as “buy when RSI looks oversold” cannot be tested. A testable rule specifies the period, the level, the trigger and the exit. For example:

  • Entry: RSI(14) crosses above 30 from below, and price is above its 200-period moving average.
  • Stop: 1.5 × ATR(14) below the entry price.
  • Exit: RSI(14) crosses above 60, or the stop is hit.

Written this way, the rule can be backtested with realistic costs, checked on data it was not tuned on, and compared with simple alternatives. Note the trend filter: combining an oscillator with a trend condition is one of the most common ways to reduce the number of signals that fight a strong trend.

Limitations

  • RSI uses closing prices only. It ignores intrabar extremes, gaps within the bar and volume.
  • It is relative to the instrument's own recent history. An RSI of 70 in a very quiet market can correspond to a small absolute move.
  • Fixed levels such as 30 and 70 behave differently across timeframes and assets. Levels chosen by optimisation on one period are prone to overfitting.
  • Signals near the threshold can flicker on and off as a bar forms. Rule-based systems should evaluate RSI on closed bars only.

Key takeaways

  • RSI = 100 − 100 / (1 + average gain / average loss), usually over 14 bars with Wilder's smoothing.
  • “Overbought” describes strong recent momentum, not an imminent fall; in trends, high RSI often confirms the move.
  • Use the same calculation and enough warm-up history in testing and live trading, and evaluate signals on closed bars.
  • Write RSI ideas as precise rules with stops and exits, then test them on data they were not tuned on.

Educational content only. This guide explains general concepts and is not investment advice or a recommendation to trade any instrument. Trading involves substantial risk of loss, and historical or simulated results do not guarantee future performance. Read the Risk Disclosure.

Related guides