Buy the 50-day pullback in an uptrend, green close
In an uptrend (50-day above the 200-day), buy when the price touches the 50-day average from above and closes green.
Killed by costs
There is something there before trading costs; after them, too little is left to count (under 0.04R a trade).
- +0.064R a trade before costs, −0.032R after the spread and the selection haircut.
42 large US stocks, 15 years
Before costs +0.064R
By trade and by day, sized to a first try
What the numbers say
Across 886 laggard trades the idea made +0.064R before costs but −0.032R after them. By market type it was −0.033R in bull, 0.033R in flat and −0.171R in bear, with no t value near the 2.01 bar. Costs erase the small edge, hence the verdict.
How it was tested
In a stock whose 50-day average is above its 200-day, buy at the close of a day that touches the 50-day average from above and closes up (green).
- 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
- "Touches" means the day's low is at or below the 50-day SMA
- "From above" means the previous close was above the previous day's 50-day SMA
- "Closes green" means close > open on the signal day, and the close must also hold at or above the 50-day SMA
- 50-day and 200-day averages are simple moving averages of closes
- No stop or target given: stop 2 x ATR(14) below entry, target 4 x ATR(14) above entry
- No hold period given: exit at the close after 20 trading days if neither stop nor target is hit
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 | 660 | −0.033R | −0.65 | −0.62 · 552d | −0.020R · beats 45% | +0.064R |
| Flat | 159 | +0.033R | 0.33 | 0.43 · 122d | −0.029R · beats 75% | −0.167R |
| Bear | 67 | −0.171R | −1.42 | −0.62 · 55d | +0.019R · beats 0% | +0.133R |
| All | 886 | −0.032R | −0.019R | +0.035R |
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 codeHide
from decimal import Decimal
from core.domain import Bar
from strategies.indicators import atr, sma
from scanners.base import Candidate
class UptrendPullback50DmaGreenClose:
name = "uptrend_pullback_to_50dma_green_close"
description = "Long when SMA50 > SMA200, price touches SMA50 from above and closes green at or above SMA50."
def __init__(self, fast: int = 50, slow: int = 200, atr_period: int = 14,
stop_mult: float = 2.0, target_mult: float = 4.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]
sma_fast_now = sma(closes, self._fast)
sma_slow_now = sma(closes, self._slow)
sma_fast_prev = sma(closes[:-1], self._fast)
if sma_fast_now is None or sma_slow_now is None or sma_fast_prev is None:
return None
f_now = Decimal(str(sma_fast_now))
s_now = Decimal(str(sma_slow_now))
f_prev = Decimal(str(sma_fast_prev))
if not (f_now > s_now):
return None
current = bars[-1]
prev = bars[-2]
if not (prev.close > f_prev):
return None
if not (current.low <= f_now):
return None
if not (current.close > current.open and current.close >= f_now):
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="Uptrend (SMA50>SMA200) pullback touched the 50-day SMA from above and closed green at or above it.",
)
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.