Bollinger squeeze breakout, narrowest width in 6 months
Bollinger squeeze: buy when the 20-day Bollinger band width is the narrowest in 6 months and the price closes above the upper band.
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.043R
By trade and by day, sized to a first try
What the numbers say
On the 22 laggards, 566 trades averaged −0.141R after costs, while the 20 winners averaged 0.172. So the result follows the winners' own rise, not the signal. In bull markets the laggards' average was −0.136R (t −2.25) and beat only 5% of random-date draws; flat and bear markets were also negative.
How it was tested
Buy at the close when 20-day Bollinger band width is at its lowest in about 6 months and the close is above the upper band.
- 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
- Band width = (upper - lower) / SMA(20), using 2 standard deviations
- 6 months = 126 trading days
- 'Narrowest' means width equals the 126-day minimum on at least one of the 5 days before the breakout, since the breakout bar itself widens the bands and rarely coincides with the minimum
- Entry is at the close of the breakout day
- Stop of 2 x ATR(14) and target of 4 x ATR(14) chosen because the idea names none
- Maximum hold of 20 trading days chosen because the idea names none
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 | 489 | −0.136R | −2.25 | −1.80 · 403d | −0.037R · beats 5% | +0.121R |
| Flat | 51 | −0.219R | −1.31 | −0.85 · 47d | −0.016R · beats 15% | +0.132R |
| Bear | 26 | −0.074R | −0.27 | −0.82 · 15d | +0.108R · beats 30% | +1.335R |
| All | 566 | −0.141R | −0.029R | +0.172R |
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.1 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 BollingerSqueezeUpperBandBreakout:
name = "bollinger_squeeze_upper_band_breakout"
description = "Close above upper Bollinger band after band width hit a 126-day low in the prior 5 days"
def __init__(self, bb_period: int = 20, num_std: float = 2.0, squeeze_lookback: int = 126,
recent_days: int = 5, atr_period: int = 14, stop_mult: float = 2.0,
target_mult: float = 4.0) -> None:
self._p = bb_period
self._k = num_std
self._lb = squeeze_lookback
self._recent = recent_days
self._atr_period = atr_period
self._stop_mult = stop_mult
self._target_mult = target_mult
def _band(self, closes, i):
w = closes[i - self._p + 1:i + 1]
mean = sum(w) / self._p
var = sum((x - mean) ** 2 for x in w) / self._p
return mean, var ** 0.5
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
n = len(bars)
t = n - 1
need = self._recent + (self._lb - 1) + self._p
if n < max(need + 1, self._atr_period + 2):
return None
closes = [float(b.close) for b in bars]
# width series for indices from t-recent-(lb-1) to t-1
first = t - self._recent - (self._lb - 1)
widths = {}
for i in range(first, t):
mean, sd = self._band(closes, i)
if mean <= 0:
return None
widths[i] = (2 * self._k * sd) / mean
squeeze = False
for d in range(t - self._recent, t):
window_min = min(widths[j] for j in range(d - self._lb + 1, d + 1))
if widths[d] <= window_min:
squeeze = True
break
if not squeeze:
return None
mean_t, sd_t = self._band(closes, t)
upper = mean_t + self._k * sd_t
if closes[t] <= upper:
return None
atr_val = atr(bars, self._atr_period)
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
if stop <= 0 or not (stop < entry < target):
return None
rr = (target - entry) / (entry - stop)
return Candidate(
ticker=ticker,
side="buy",
entry=entry,
stop=stop,
target=target,
risk_reward_ratio=rr.quantize(Decimal("0.01")),
signal_strength=50,
thesis="Close above upper Bollinger band after a 126-day low in band width within the prior 5 days.",
)
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.