21-day EMA turns up after 10 straight days of falling
Buy when the 21-day EMA turns up after falling for 10 days in a row.
Works in one market only
It holds up in one kind of market only.
- It clears the bar in the bear market only.
42 large US stocks, 15 years
Before costs +0.138R
By trade and by day, sized to a first try
What the numbers say
On the laggards the idea averaged 0.050R per trade after costs over 1144 trades. Only the bear market clears the bar: 0.400R per trade with t by day 4.05, against 2.01 needed. In bull markets it gave −0.011R (t −0.30), in flat markets 0.033R (t 0.22), so the edge sits in one market type.
How it was tested
Buy at the close on the first day the 21-day EMA of close rises after it fell on each of the previous 10 days.
- 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
- 'Turns up' means EMA21 today is higher than EMA21 yesterday
- 'Falling 10 days in a row' means EMA21 declined on each of the 10 days immediately before the turn day
- EMA21 is computed on daily closes with standard smoothing (alpha = 2/22)
- No stop or target given: chose 2 x ATR(14) stop and target at twice the risk
- No holding period given: chose 20 trading days maximum
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 | 805 | −0.011R | −0.24 | −0.30 · 570d | −0.063R · beats 80% | +0.130R |
| Flat | 190 | +0.033R | 0.37 | 0.22 · 133d | −0.039R · beats 75% | +0.011R |
| Bear | 149 | +0.400R | 4.11 | 4.05 · 81d | +0.096R · beats 100% | +0.092R |
| All | 1,144 | +0.050R | −0.038R | +0.099R |
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.2 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 Ema21TurnUpAfter10DayDecline:
name = "ema21_turn_up_after_10_day_decline"
description = "Long when EMA21 rises today after falling on each of the previous 10 days."
def __init__(self, ema_period: int = 21, down_days: int = 10, atr_period: int = 14,
stop_mult: float = 2.0, target_mult: float = 4.0) -> None:
self._period = ema_period
self._down_days = down_days
self._atr_period = atr_period
self._stop_mult = stop_mult
self._target_mult = target_mult
def _ema_series(self, closes):
p = self._period
if len(closes) < p:
return None
alpha = 2.0 / (p + 1)
e = sum(closes[:p]) / p
out = [e]
for c in closes[p:]:
e = alpha * c + (1.0 - alpha) * e
out.append(e)
return out
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
need = self._period + self._down_days + 2
if len(bars) < max(need, self._atr_period + 2):
return None
closes = [float(b.close) for b in bars]
ema_s = self._ema_series(closes)
if ema_s is None or len(ema_s) < self._down_days + 2:
return None
# turn up today
if not (ema_s[-1] > ema_s[-2]):
return None
# fell on each of the previous N days (days t-1 .. t-N)
for d in range(1, self._down_days + 1):
if not (ema_s[-1 - d] < ema_s[-2 - d]):
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="EMA21 turned up after falling ten consecutive 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.