Skip to content
The Casebook · A classic strategy

20-day average crossing above the 50-day, long

Buy when the 20-day moving average crosses above the 50-day moving average; exit when it crosses back below.
VerdictTested Nov 22, 2026

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.
Trades on the laggards
881

42 large US stocks, 15 years

Per trade, after costs
−0.016R

Before costs +0.053R

Bar to clear
t > 2.01

By trade and by day, sized to a first try

What the numbers say

On the 22 laggards the idea averaged −0.016R per trade after costs over 881 trades, against 0.157R on today's winners. Bull markets gave −0.021R (t −0.59), flat −0.04R (t −0.61), bear 0.098R (t 1.10), all short of the 2.01 bar. The gain on the winners did not carry over to the laggards.

How it was tested

Go long at the close when the 20-day SMA of closes crosses above the 50-day SMA, and exit when the 20-day crosses back below the 50-day.

Side
Long
Its own exit
At each close after entry, exit at that close if SMA(close,20) < SMA(close,50) (the 20-day has crossed back below the 50-day)., checked at each close
Time limit
Exit at the close after 30 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
Choices made where the idea was open
  • Moving averages are simple moving averages of daily closes
  • A cross means the 20-day SMA moves from at-or-below to above the 50-day SMA between consecutive closes
  • The idea names no stop or target, so wide protective ones are chosen: stop 4 x ATR(14) below entry, target 8 x ATR(14) above entry
  • Because the idea's own exit is the reverse cross, the stop and target are only protective
  • The harness caps holding at 30 trading days, so the trade exits at the close of day 30 if no other exit has fired

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.

MarketTradesPer tradet, by tradet, by dayRandom datesWinners, per trade
Bull636−0.021R−0.59−0.63 · 528d−0.067R · beats 95%+0.152R
Flat175−0.040R−0.61−0.81 · 150d−0.081R · beats 75%+0.211R
Bear70+0.098R1.100.81 · 52d−0.089R · beats 100%+0.095R
All881−0.016R−0.071R+0.157R

R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 14.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 code
from decimal import Decimal

from core.domain import Bar
from strategies.indicators import atr, sma
from scanners.base import Candidate


class Sma2050GoldenCrossLong:
    name = "sma20_50_golden_cross_long"
    description = "Long when SMA20 crosses above SMA50; exit on reverse cross."

    def __init__(self, fast: int = 20, slow: int = 50, atr_period: int = 14,
                 stop_mult: float = 4.0, target_mult: float = 8.0) -> None:
        self._fast = fast
        self._slow = slow
        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:
        if len(bars) < self._slow + 2:
            return None
        closes = [b.close for b in bars]
        f_now = sma(closes, self._fast)
        s_now = sma(closes, self._slow)
        f_prev = sma(closes[:-1], self._fast)
        s_prev = sma(closes[:-1], self._slow)
        if f_now is None or s_now is None or f_prev is None or s_prev is None:
            return None
        f_now = Decimal(str(f_now))
        s_now = Decimal(str(s_now))
        f_prev = Decimal(str(f_prev))
        s_prev = Decimal(str(s_prev))
        if not (f_now > s_now and f_prev <= s_prev):
            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
        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="20-day SMA crossed above 50-day SMA (golden cross) at the close.",
        )

    def exit_now(self, ticker: str, bars: list[Bar], entry: Decimal,
                 side: str, bars_held: int) -> bool:
        if len(bars) < self._slow:
            return False
        closes = [b.close for b in bars]
        f = sma(closes, self._fast)
        s = sma(closes, self._slow)
        if f is None or s is None:
            return False
        return Decimal(str(f)) < Decimal(str(s))

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.

Have an idea of your own?

Describe it in plain words and get the same honest test in about a minute.

Run the Gauntlet