Rising 200-day average, buy at a 20-day closing high
Buy when the 200-day moving average is rising and the stock closes at a 20-day high.
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.039R
By trade and by day, sized to a first try
What the numbers say
On the laggards, 7807 trades averaged −0.055R after costs, against 0.097R on today's winners. In flat markets the result was −0.117R (t −3.28) and beat only 5% of random-date draws; in bull markets it was −0.042R. The gain showed only where stocks had already risen.
How it was tested
Buy a stock that closes at a 20-day high while its 200-day simple moving average is rising.
- 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
- Rising 200-day MA means SMA(close,200) today is above its value yesterday
- 20-day high is measured on closing prices, including today's close
- Moving average is a simple moving average of closes
- No stop or target was given: stop set at 2 x ATR(14) below entry, target at twice the risk
- No holding period was given: time exit set at 20 trading days
- Entry is at the signal day's close
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 | 6,363 | −0.042R | −2.58 | −2.63 · 2,024d | −0.031R · beats 45% | +0.076R |
| Flat | 1,162 | −0.117R | −3.28 | −2.85 · 431d | −0.029R · beats 5% | +0.225R |
| Bear | 282 | −0.083R | −1.30 | −1.46 · 145d | +0.053R · beats 10% | +0.209R |
| All | 7,807 | −0.055R | −0.028R | +0.097R |
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.0 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, sma
from scanners.base import Candidate
class RisingMA200TwentyDayHighBreakoutLong:
name = "rising_200dma_20day_high_breakout_long"
description = "Close at 20-day closing high while SMA200 is rising; 2x ATR stop, 4x ATR target."
def __init__(self, ma_period: int = 200, high_lookback: int = 20, atr_period: int = 14, stop_mult: float = 2.0, target_mult: float = 4.0) -> None:
self._ma_period = ma_period
self._high_lookback = high_lookback
self._atr_period = atr_period
self._stop_mult = stop_mult
self._target_mult = target_mult
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
need = max(self._ma_period + 1, self._high_lookback, self._atr_period + 1)
if len(bars) < need:
return None
closes = [b.close for b in bars]
sma_today = sma(closes, self._ma_period)
sma_prev = sma(closes[:-1], self._ma_period)
if sma_today is None or sma_prev is None:
return None
if not (Decimal(str(sma_today)) > Decimal(str(sma_prev))):
return None
window = closes[-self._high_lookback:]
current = bars[-1]
if current.close < max(window):
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 = current.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="Closed at a 20-day closing high while the 200-day SMA is rising.",
)
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.