Skip to content
The Casebook · A classic strategy

Price above 20/50/200-day averages, all rising

Buy when the price is above its 20, 50 and 200-day moving averages and all three are rising; exit when it closes below the 20-day.
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
2,596

42 large US stocks, 15 years

Per trade, after costs
−0.086R

Before costs −0.005R

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.086R per trade after costs over 2596 trades, versus 0.048R on today's winners. It was negative in bull (−0.088), flat (−0.063) and bear (−0.114) markets, and beat only 10% of random-date draws in bull and bear. The winners' own rise did the work.

How it was tested

Go long when the close is above the rising 20, 50 and 200-day simple moving averages, and exit on the first close below the 20-day average.

Side
Long
Its own exit
Exit at the first close after entry where close < SMA20 (computed from bars up to that 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 (SMA) on closing prices
  • 'Rising' means today's average is above yesterday's average
  • Signal fires only on the first day all conditions become true, not on every day they hold
  • Stop set at 3 x ATR(14) and target at 8 x ATR(14) as wide protective levels since the idea's own exit is the 20-day close rule
  • Time limit of 30 trading days applied as the harness maximum since the idea names no holding limit

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
Bull2,045−0.088R−5.08−4.98 · 1,301d−0.067R · beats 10%+0.047R
Flat400−0.063R−1.61−0.95 · 263d−0.065R · beats 50%+0.031R
Bear151−0.114R−2.14−1.19 · 115d−0.040R · beats 10%+0.138R
All2,596−0.086R−0.065R+0.048R

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


class TripleMaTrendExitBelow20Ma:
    name = "triple_ma_trend_exit_below_20ma"
    description = "Long on first day close is above rising SMA20/50/200; exit on first close below SMA20."

    def __init__(self, fast: int = 20, mid: int = 50, slow: int = 200,
                 atr_period: int = 14, stop_mult: float = 3.0,
                 target_mult: float = 8.0) -> None:
        self._fast = fast
        self._mid = mid
        self._slow = slow
        self._atr_period = atr_period
        self._stop_mult = stop_mult
        self._target_mult = target_mult

    @staticmethod
    def _sma_at(closes, idx, period):
        # SMA of the `period` closes ending at index idx (inclusive)
        start = idx - period + 1
        if start < 0:
            return None
        total = sum(closes[start:idx + 1])
        return total / period

    def _setup_at(self, closes, idx):
        for period in (self._fast, self._mid, self._slow):
            cur = self._sma_at(closes, idx, period)
            prev = self._sma_at(closes, idx - 1, period)
            if cur is None or prev is None:
                return False
            if not (closes[idx] > cur):
                return False
            if not (cur > prev):
                return False
        return True

    def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
        n = len(bars)
        if n < self._slow + 2:
            return None
        closes = [b.close for b in bars]
        if not self._setup_at(closes, n - 1):
            return None
        if self._setup_at(closes, n - 2):
            return None

        atr_val = atr(bars, self._atr_period)
        if atr_val is None:
            return None
        atr_dec = Decimal(str(atr_val))
        if atr_dec <= 0:
            return None

        entry = bars[-1].close
        stop = entry - Decimal(str(self._stop_mult)) * atr_dec
        target = entry + Decimal(str(self._target_mult)) * atr_dec
        if 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="First day close is above rising 20, 50 and 200-day SMAs; exit on first close below SMA20.",
        )

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

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
Price above 20/50/200-day averages, all rising: Survivorship mirage · EdgeProven