MomentumReference · Indicator Library

RSI

Relative Strength Index

A momentum oscillator that measures the speed and magnitude of recent price changes on a bounded 0–100 scale.

RSI is a momentum oscillator that measures the speed and magnitude of recent price changes on a 0–100 scale. Developed by J. Welles Wilder, it signals overbought above 70, oversold below 30, and weakening momentum through divergences with price. Default lookback: 14 bars.

The Relative Strength Index (RSI), developed by J. Welles Wilder, compares the magnitude of recent gains to recent losses over a chosen lookback (typically 14 bars). Readings above 70 are conventionally "overbought," below 30 "oversold" — but the real power of RSI lies in how it behaves inside those zones and in divergence against price.

In strong trends, oversold and overbought levels shift: an uptrend may respect RSI 40 as support and push well above 70 without reversing. Treat RSI as a relative measure of momentum rather than a mean-reversion trigger on its own.

How do I read RSI?

  • Above 70 = overbought. In strong uptrends, RSI can stay above 70 for many bars without reversing — treat "overbought" as context, not a sell signal.
  • Below 30 = oversold. In strong downtrends, RSI can stay pinned below 30 for extended periods. Same rule applies in reverse.
  • The 50 line is momentum equilibrium. In uptrends, RSI typically finds support near 40–50 on pullbacks; in downtrends, resistance near 50–60 on bounces.
  • Bullish divergence: price prints a lower low while RSI prints a higher low. Signals fading downside momentum, often before a reversal.
  • Bearish divergence: price prints a higher high while RSI prints a lower high. Signals fading upside momentum.

How is RSI calculated?

RSI compares the average size of up-bars to the average size of down-bars over the lookback period, then maps that ratio to a 0–100 scale.

  1. 1.For each bar, compute the price change versus the previous close.
  2. 2.Separate gains (positive changes) from losses (the absolute value of negative changes).
  3. 3.Smooth gains and losses with 14-bar Wilder smoothing (RMA in Pine Script) to get AvgGain and AvgLoss.
  4. 4.Compute the relative strength: RS = AvgGain / AvgLoss.
  5. 5.Convert to RSI: RSI = 100 − 100 / (1 + RS).

What are the default RSI settings?

ParameterDefaultWhen to adjust
Lookback period14Wilder's original setting. Drop to 9 for faster signals on intraday charts; raise to 21 for less noise on daily charts.
SourceCloseMost common. Some traders use HLC3 or HL2 for smoother readings on volatile assets.
Overbought threshold70Raise to 80 in strong uptrends to filter trend-continuation false sells.
Oversold threshold30Drop to 20 in strong downtrends to filter trend-continuation false buys.
Smoothing methodWilder (RMA)Pine Script's ta.rsi() uses Wilder's smoothing by default. Custom EMA-based RSIs produce different values.

How do I plot RSI in Pine Script?

//@version=5
indicator("RSI Example", overlay=false)

length = input.int(14, title="Length", minval=2)
src    = input.source(close, title="Source")

rsiValue = ta.rsi(src, length)

plot(rsiValue, title="RSI", color=color.purple, linewidth=2)
hline(70, "Overbought", color=color.red,   linestyle=hline.style_dashed)
hline(30, "Oversold",   color=color.green, linestyle=hline.style_dashed)

TradingView's built-in ta.rsi() handles Wilder's smoothing for you, so you don't need to compute average gains and losses by hand. Wire length and src to inputs so users can tune both without editing the script. Plot horizontal lines at 70 and 30 to mark the conventional thresholds — a small detail that makes the chart instantly readable.

Continue exploring

Related indicators

Browse all indicators

About this reference

This page is an educational reference explaining what RSI is, how it is calculated, its default settings, and how to plot it in Pine Script. It is compiled from established trading literature and public technical documentation. Last review: .

Educational content. Not financial advice.