The Intuition

The Relative Strength Index, developed by J. Welles Wilder in 1978, measures the velocity and magnitude of recent price changes to evaluate overbought or oversold conditions. Unlike simple price levels, RSI normalises momentum to a 0–100 scale, making it comparable across instruments and time periods.

The economic intuition: markets have a psychological component. When buyers aggressively push a price higher over a short period, RSI rises sharply. At extreme readings — say, above 70 — sentiment is stretched. Late buyers have entered, early buyers are sitting on large gains and may take profit, and there are few new buyers left to sustain the move. Mean reversion is then the expected path.

Wilder designed RSI using exponential moving averages of gains and losses, which gives more weight to recent price action. This makes it reactive to recent volatility without being as noisy as a simple momentum oscillator. The 14-period default was chosen empirically for daily data; shorter periods (7–9) suit faster traders, longer periods (21–28) suit swing traders.

Key assumptions: (1) Price momentum is bounded — extremes are self-correcting. (2) The 70/30 thresholds are meaningful cutoffs for the instrument being traded. (3) The series has no structural break or regime change within the lookback window. In strong trends, RSI can stay "overbought" for extended periods, making naive RSI shorts very painful.

The strategy performs best in range-bound, oscillating markets. In strong momentum regimes, RSI signals are systematically wrong: a stock in a strong uptrend keeps printing RSI > 70. Practitioners often combine RSI with a trend filter (e.g., only take RSI short signals when price is below the 200-day moving average) to mitigate this.

The Math

Read this as a compact model summary: what the signal sees, what it ignores, and where fragility can creep in.

RS(t)    = AvgGain(t, n) / AvgLoss(t, n)
RSI(t)   = 100 - 100 / (1 + RS(t))

Signal(t) = +1  if RSI(t) < oversold threshold
          = -1  if RSI(t) > overbought threshold
          =  0  otherwise

Parameters

ParameterTypeDefaultDescription
rsi_period int 14 RSI lookback period
oversold float 30.0 RSI threshold for long signal
overbought float 70.0 RSI threshold for short signal

Source Code

def run(ticker: str, start: str, end: str, **params) -> dict:
    rsi_period = int(params.get("rsi_period", 14))
    oversold = float(params.get("oversold", 30.0))
    overbought = float(params.get("overbought", 70.0))
    df = fetch_ohlcv(ticker, start, end)
    positions = _signal(df, rsi_period, oversold, overbought)
    return run_backtest(df, positions, ticker=ticker, start=start, end=end,
                        strategy=METADATA["slug"],
                        params={"rsi_period": rsi_period, "oversold": oversold, "overbought": overbought})

Further Reading

  • Wilder, J.W. (1978). New Concepts in Technical Trading Systems. Trend Research.
  • Connors, L. & Alvarez, C. (2009). Short Term Trading Strategies That Work. TradingMarkets Publishing.
  • Chan, E. (2013). Algorithmic Trading, Ch. 2. Wiley.

When It Works / When It Fails

Works
  • Range-bound markets with regular overbought/oversold cycles
  • Pullback entries in broadly trending instruments
  • Liquid broad indices with predictable oscillation patterns
Fails
  • Strong sustained trends — RSI stays elevated or depressed
  • Gap-prone instruments with binary event-driven risk
  • Persistent momentum regimes where reversal signals are costly

Regime Fit

Transition / Calm vol
Best conditions at 1.0. Clean oscillation with reliable overbought/oversold readings.
Transition / Normal vol
Strong fit at 0.75. Some noise but mean-reversion signal structure is intact.
Bull or Bear / Calm vol
Reduced to 0.7. Slow trends may allow partial reversion entries.
Any regime / Stressed vol
Exposure drops to 0.0. RSI pins at extremes; reversal signals are unreliable.

Compared to Alternatives

vs Williams %R
RSI is path-dependent via cumulative avg gains/losses; Williams %R uses only range position. RSI is smoother; %R reacts instantly to new price extremes.
vs Bollinger
RSI measures a cumulative gain/loss ratio; Bollinger measures std-dev distance from price mean. Different volatility-adaptive approaches to the same reversal idea.
vs Connors RSI
Standard RSI uses one component; Connors RSI is composite of price RSI, streak RSI, and return percentile rank. CRSI has fewer false extremes but is less transparent.
Run This Strategy →