RSI divergence at a new 20-day low, 14-day RSI
RSI divergence: buy when the price makes a new 20-day low but the 14-day RSI makes a higher low than at the last one.
Survivorship mirage
It clears the bar on today's winners, the stocks everyone wishes they had bought, but not on the laggards, which is where hindsight can't help.
- It clears the bar on today's winners but not on the laggards: the winners' own rise did the work.
42 large US stocks, 15 years
Before costs +0.107R
By trade and by day, sized to a first try
What the numbers say
On the 22 laggards the idea returned 0.021R per trade after costs over 2091 trades, against 0.179 on today's winners. Bull markets came out at −0.026, flat at 0.053, bear at 0.138. The edge shows up only where the stocks' own rise lifted results, hence the survivorship mirage verdict.
How it was tested
Buy at the close when price sets a new 20-day closing low but the 14-day RSI is higher than it was at the previous 20-day-low close.
- Side
- Long
- Time limit
- Exit at the close after 15 trading days, unless the stop, the target or its own exit comes first
- Bar to clear
- t > 2.01, by trade and by day, sized to a first try (one idea, tested once)
- Prices
- 15 years of daily bars through 2026-11-20; judged 2026-11-22
- "New 20-day low" = today's close is the lowest close of the last 20 bars, including today
- "Last one" = the most recent earlier day that was itself a 20-day closing low, at least 5 bars before today and within the prior 60 bars
- Price must be strictly lower than at that prior low, and RSI strictly higher
- RSI is Wilder's RSI with a 14-day period, computed on closes
- Idea names no stop or target: chose stop at 2 x ATR(14) and target at 4 x ATR(14)
- Idea names no hold limit: chose 15 trading days
The evidence
The laggards decide: 22 large stocks that lagged or fell, where hindsight can't flatter a rule. Today's winners sit beside them to show what survivorship would add.
| Market | Trades | Per trade | t, by trade | t, by day | Random dates | Winners, per trade |
|---|---|---|---|---|---|---|
| Bull | 1,262 | −0.026R | −0.79 | −1.56 · 848d | −0.063R · beats 80% | +0.205R |
| Flat | 443 | +0.053R | 0.95 | −0.58 · 233d | −0.041R · beats 95% | +0.032R |
| Bear | 386 | +0.138R | 2.18 | 1.36 · 160d | +0.107R · beats 70% | +0.269R |
| All | 2,091 | +0.021R | −0.028R | +0.179R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 13.4 bps) plus 0.045R for the fills a real order wouldn't get. “By day” groups trades opened the same day, so a rule that fires on the same dates for every stock counts as a few events. “Random dates” places the same plan on random days of the same stocks in the same kind of market, 20 times; the idea must beat 95% of those draws.
The scanner we wroteShow the codeHide
from decimal import Decimal
from core.domain import Bar
from strategies.indicators import atr
from scanners.base import Candidate
class RsiBullishDivergence20dLow:
name = "rsi_bullish_divergence_20d_low"
description = "New 20-day closing low with higher RSI(14) than at the prior 20-day closing low"
def __init__(self, low_window: int = 20, rsi_period: int = 14, min_gap: int = 5,
max_lookback: int = 60, stop_mult: float = 2.0, target_mult: float = 4.0) -> None:
self._win = low_window
self._rsi_period = rsi_period
self._min_gap = min_gap
self._max_lb = max_lookback
self._stop_mult = stop_mult
self._target_mult = target_mult
def _rsi_series(self, closes):
n = len(closes)
p = self._rsi_period
out = [None] * n
if n <= p:
return out
gains = 0.0
losses = 0.0
for i in range(1, p + 1):
ch = closes[i] - closes[i - 1]
if ch > 0:
gains += ch
else:
losses -= ch
avg_g = gains / p
avg_l = losses / p
out[p] = 100.0 if avg_l == 0 else 100.0 - 100.0 / (1.0 + avg_g / avg_l)
for i in range(p + 1, n):
ch = closes[i] - closes[i - 1]
g = ch if ch > 0 else 0.0
l = -ch if ch < 0 else 0.0
avg_g = (avg_g * (p - 1) + g) / p
avg_l = (avg_l * (p - 1) + l) / p
out[i] = 100.0 if avg_l == 0 else 100.0 - 100.0 / (1.0 + avg_g / avg_l)
return out
def _is_low(self, closes, i):
if i < self._win - 1:
return False
window = closes[i - self._win + 1:i + 1]
return closes[i] <= min(window)
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
if len(bars) < self._max_lb + self._win + 5:
return None
closes = [float(b.close) for b in bars]
t = len(closes) - 1
if not self._is_low(closes, t):
return None
p_idx = None
start = t - self._min_gap
stop_i = max(0, t - self._max_lb)
i = start
while i >= stop_i:
if self._is_low(closes, i):
p_idx = i
break
i -= 1
if p_idx is None:
return None
if not (closes[t] < closes[p_idx]):
return None
rsis = self._rsi_series(closes)
r_t = rsis[t]
r_p = rsis[p_idx]
if r_t is None or r_p is None:
return None
if not (r_t > r_p):
return None
atr_val = atr(bars, 14)
if atr_val is None or atr_val <= 0:
return None
atr_dec = Decimal(str(atr_val))
entry = bars[-1].close
stop = entry - Decimal(str(self._stop_mult)) * atr_dec
target = entry + Decimal(str(self._target_mult)) * atr_dec
risk = entry - stop
if risk <= 0 or stop <= 0:
return None
rr = (target - entry) / risk
return Candidate(
ticker=ticker,
side="buy",
entry=entry,
stop=stop,
target=target,
risk_reward_ratio=rr.quantize(Decimal("0.01")),
signal_strength=50,
thesis=f"New 20-day closing low with RSI {r_t:.1f} above RSI {r_p:.1f} at prior low {t - p_idx} bars ago.",
)
Hypothetical results from our own backtest of the rule as restated, on 42 large US stocks over 15 years. Past performance, real or simulated, does not predict future results. Research and education only; not investment advice.
Describe it in plain words and get the same honest test in about a minute.