Divergence

When price makes a new extreme but an indicator like RSI doesn't confirm it, suggesting the move is losing momentum. Widely discussed and genuinely difficult to trade — divergence can persist far longer than expected before it resolves.

Divergence occurs when price and a momentum indicator are telling different stories. Price makes a new extreme — a higher high or a lower low — but the oscillator fails to confirm it. This disconnect is a warning: the momentum driving the move is weakening, even though price has pushed further.

Bullish divergence is the classic setup: price makes a lower low while RSI makes a higher low. Price is falling further but selling pressure is decreasing. Bearish divergence is the inverse: price makes a higher high while RSI makes a lower high. Price is still rising but buyers are losing conviction.

The same logic applies to MACD, Stochastic, and other momentum oscillators. RSI is the most commonly used because its bounded 0–100 scale makes the comparison clear.

Why it matters

Pure price analysis misses what is happening underneath the surface. Two price highs at exactly the same level can have completely different momentum profiles. One might be backed by expanding momentum — a continuation is likely. The other might show declining momentum — a reversal is becoming more probable. Divergence is how you see the difference.

There are two important caveats. First, divergence is a warning sign, not a trigger. Price can continue making lower lows while RSI diverges for multiple bars before a reversal actually occurs. Trading on divergence alone, without a price structure reason to enter (a support level, a prior swing, a consolidation), often results in early entries that get stopped out before the reversal develops.

Second, divergence in a strong trend is less reliable than divergence at clear extremes — RSI below 30 with a bullish divergence is more meaningful than the same pattern at RSI 50. Context matters.

//@version=6
indicator("Divergence Demo", overlay=false)

rsi      = ta.rsi(close, 14)
lookback = input.int(5, "Lookback Bars", minval=2, maxval=20)

// Bullish divergence: price making a lower low while RSI makes a higher low
priceLow   = ta.lowest(low, lookback)
rsiLow     = ta.lowest(rsi, lookback)
bullishDiv = low <= priceLow and rsi > rsiLow and rsi < 40

// Bearish divergence: price making a higher high while RSI makes a lower high
priceHigh  = ta.highest(high, lookback)
rsiHigh    = ta.highest(rsi, lookback)
bearishDiv = high >= priceHigh and rsi < rsiHigh and rsi > 60

plot(rsi, "RSI", color=color.purple, linewidth=2)
hline(70, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(50, "Midline",    color=color.gray, linestyle=hline.style_dotted)
hline(30, "Oversold",   color=color.green, linestyle=hline.style_dashed)

plotshape(bullishDiv, title="Bullish Div", style=shape.triangleup,   location=location.bottom, color=color.green, size=size.small)
plotshape(bearishDiv, title="Bearish Div", style=shape.triangledown, location=location.top,    color=color.red,   size=size.small)

Key takeaway: Divergence is confirmation context, not a standalone entry trigger. Combine it with an overbought/oversold extreme and a price structure reason — a support level, a prior swing low, a consolidation zone — to get setups with a coherent thesis. Divergence without location is just a pattern. Divergence at a meaningful price level is a trade.