Breakout of a tight 20-day range (under 8% wide)
Buy the breakout of a 20-day range when the range was less than 8% wide.
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.004R
By trade and by day, sized to a first try
What the numbers say
On the 22 laggards the idea averaged −0.097R per trade after costs over 2336 trades, against 0.152 on today's winners. It was negative in bull (−0.085) and flat (−0.215) markets and beat 0.0% of random-date draws in both. The winners' own rise explains the gap, hence the verdict.
How it was tested
Buy at the close when price closes above the prior 20-day high after that 20-day range was less than 8% wide.
- Side
- Long
- Time limit
- Exit at the close after 20 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
- Range = highest high minus lowest low over the 20 trading days before the signal day, excluding the signal day
- Width % = (highest high - lowest low) / lowest low, and must be below 8%
- Breakout = daily close above the prior 20-day highest high
- Entry at the close of the breakout day
- Stop chosen as the tighter of 2 x ATR(14) below entry or the range low
- Target chosen as 2R (twice the risk)
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,972 | −0.085R | −2.84 | −3.15 · 1,075d | −0.028R · beats 0% | +0.133R |
| Flat | 301 | −0.215R | −3.22 | −1.89 · 187d | +0.023R · beats 0% | +0.266R |
| Bear | 63 | +0.076R | 0.49 | −0.59 · 38d | +0.060R · beats 45% | +0.821R |
| All | 2,336 | −0.097R | −0.019R | +0.152R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 12.9 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 NarrowRangeBreakoutLong:
name = "narrow_20d_range_breakout_long"
description = "Close above prior 20-day high after a prior range narrower than 8%"
def __init__(self, lookback: int = 20, max_width: float = 0.08, atr_period: int = 14, atr_mult: float = 2.0, rr_mult: float = 2.0) -> None:
self._lookback = lookback
self._max_width = Decimal(str(max_width))
self._atr_period = atr_period
self._atr_mult = Decimal(str(atr_mult))
self._rr_mult = Decimal(str(rr_mult))
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
need = max(self._lookback + 1, self._atr_period + 1)
if len(bars) < need:
return None
window = bars[-(self._lookback + 1):-1]
if len(window) < self._lookback:
return None
hh = max(b.high for b in window)
ll = min(b.low for b in window)
if ll <= 0:
return None
width = (hh - ll) / ll
if width >= self._max_width:
return None
current = bars[-1]
if current.close <= hh:
return None
atr_val = atr(bars, self._atr_period)
if atr_val is None or atr_val <= 0:
return None
entry = current.close
stop = max(entry - self._atr_mult * Decimal(str(atr_val)), ll)
risk = entry - stop
if risk <= 0:
return None
target = entry + self._rr_mult * risk
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"Closed above prior {self._lookback}-day high after a {float(width) * 100:.1f}% wide range.",
)
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.