RSI indicator explained: overbought, oversold and the formula
The RSI, or Relative Strength Index, is a momentum oscillator that compresses recent price action into a single number between 0 and 100. It compares the average size of recent up-moves to the average size of recent down-moves, telling you whether buyers or sellers have had the upper hand lately. By convention, readings above 70 are called "overbought" and below 30 "oversold" — but those are descriptions of momentum, not buy and sell buttons. This guide explains the 0-100 scale, the 70/30 levels, the actual formula, divergence, the common settings, and the most important honest caveat: in a strong trend, oversold can stay oversold for a very long time.
Last updated 21 June 2026 · by Mustafa Bilgic
What the RSI is
The Relative Strength Index was introduced by J. Welles Wilder in 1978 and remains one of the most widely used indicators in trading. It is a momentum oscillator: it does not tell you whether a price is cheap or expensive in any fundamental sense, only how fast and how forcefully it has been moving lately. The "relative strength" in the name refers to the strength of recent gains relative to recent losses — not, despite the name, to comparing one asset against another. Because it bounds itself between 0 and 100, it gives a normalised reading you can apply the same way across any asset or timeframe, which is why it appears in so many trading-bot strategies.
The 0 to 100 scale
RSI always lives between 0 and 100. A reading near 100 would mean almost every recent bar closed up — relentless buying. A reading near 0 would mean almost every recent bar closed down — relentless selling. In practice you rarely see the extremes; most of the time RSI oscillates through the middle band. The 50 level acts as a rough midline: persistently above 50 suggests up-momentum has the upper hand, persistently below 50 suggests down-momentum dominates. The value updates on every new bar, sliding up as gains accumulate and down as losses do.
Overbought and oversold: the 70/30 levels
The famous thresholds are 70 and 30. When RSI rises above 70, the asset is conventionally called overbought — price has climbed quickly and momentum may be stretched. When it falls below 30, it is called oversold — price has dropped quickly and may be due a bounce. The naïve interpretation is "sell at 70, buy at 30," and that is exactly where most beginners lose money.
"Overbought" only means the recent move up was fast — it does not mean the move is over. In a powerful uptrend RSI can pin above 70 for weeks while price keeps making new highs. Treating 70 as an automatic sell, or 30 as an automatic buy, fights the trend and is one of the most common ways the RSI is misused.
The RSI formula
The calculation is straightforward. Over a lookback period (the default is 14 bars) you separate price changes into gains and losses, average each, and form a ratio called relative strength (RS), then map it onto the 0-100 scale:
rsi formulaRS = average gain ÷ average loss # over the last n bars
RSI = 100 − ( 100 ÷ ( 1 + RS ) )
# Worked feel for the bounds:
# if avg loss = 0 → RS = ∞ → RSI = 100 (all up-moves)
# if avg gain = 0 → RS = 0 → RSI = 0 (all down-moves)
# if gains = losses → RS = 1 → RSI = 50 (balanced)
Wilder used a smoothed (exponential-style) average of gains and losses rather than a simple one, which makes the indicator react more steadily. The exact smoothing matters when comparing implementations, but the shape is always the same: more up-strength pushes RSI toward 100, more down-strength toward 0.
A Python example
Here is a compact RSI in pandas using Wilder's smoothing. It returns the indicator as a column you can then threshold or feed into a signal:
python · rsi.pyimport pandas as pd
def rsi(df, period=14):
"""Wilder's RSI on the close, 0-100."""
delta = df['close'].diff()
gain = delta.clip(lower=0) # up-moves only
loss = -delta.clip(upper=0) # down-moves as positives
avg_gain = gain.ewm(alpha=1/period, adjust=False).mean()
avg_loss = loss.ewm(alpha=1/period, adjust=False).mean()
rs = avg_gain / avg_loss
df['rsi'] = 100 - (100 / (1 + rs))
return df
To turn this into a tradeable rule you would compare df['rsi'] to your thresholds on the previous closed bar — the same no-look-ahead discipline used everywhere on this site. See the full RSI trading strategy for entry and exit variations, and test any of them on the backtester before trusting them.
Divergence
One of the more respected uses of RSI is spotting divergence — when price and the indicator disagree. Bearish divergence is when price makes a higher high but RSI makes a lower high, hinting that the rally is losing internal strength even as price climbs. Bullish divergence is the reverse: price makes a lower low but RSI makes a higher low, hinting that selling is weakening. Divergence can be an early warning that a trend is tiring, but it is not a precise timing signal — divergences can persist for a long time before price reacts, and many resolve by the trend simply continuing. Use it as a flag to pay attention, not as a standalone trigger.
Why oversold can stay oversold
This is the most important honest caveat about the RSI, and it is worth repeating because it is where the indicator most often fails beginners. RSI measures momentum, not value. In a strong downtrend, selling pressure stays dominant bar after bar, so the average loss stays high and RSI can sit below 30 — even below 20 — for an extended stretch while price keeps falling. A trader who mechanically buys every oversold reading is buying into relentless selling: catching a falling knife. The mirror image happens in uptrends, where RSI parks above 70 and "overbought" never reverses. The lesson is that RSI describes how the recent move happened, not whether it is finished. It works best as one input among several — confirmed by trend context, support levels, or another signal — and far worse as a lone buy/sell switch. Combine it sensibly, respect the trend, and always validate on real data rather than on a tidy textbook chart.
Frequently asked questions
What does the RSI indicator measure?
RSI, the Relative Strength Index, measures the speed and size of recent price changes on a scale from 0 to 100. It compares the average of recent up-moves to the average of recent down-moves to gauge whether buying or selling pressure has dominated lately. It is a momentum oscillator, not a price target.
What do 70 and 30 mean on the RSI?
By convention an RSI above 70 is called overbought, suggesting price has risen quickly and may pause, and below 30 is oversold, suggesting it has fallen quickly and may bounce. These are descriptive thresholds, not buy and sell buttons — they describe momentum, and price can stay beyond them for a long time in a strong trend.
Why can oversold stay oversold?
Because RSI measures momentum, not value. In a strong downtrend, selling pressure stays dominant for a long time, so RSI can sit below 30 for many bars while price keeps falling. Buying simply because RSI is oversold catches a falling knife. Oversold means the move has been fast, not that it is over.
What are the common RSI settings?
The standard is a 14-period RSI with 70/30 thresholds, as defined by its creator. Shorter periods like 7 or 9 make it more sensitive and noisier; longer periods like 21 make it smoother and slower. Some traders use 80/20 to reduce false signals in trending markets. The right settings depend on your timeframe and should be backtested.