10-day EMA crossing above the 30-day EMA, long
Buy when the 10-day EMA crosses above the 30-day EMA and sell when it crosses back below.
Killed by costs
There is something there before trading costs; after them, too little is left to count (under 0.04R a trade).
- +0.061R a trade before costs, −0.015R after the spread and the selection haircut.
42 large US stocks, 15 years
Before costs +0.061R
By trade and by day, sized to a first try
What the numbers say
On 1411 laggard trades the idea made +0.061R a trade before costs but −0.015R after the spread and the selection haircut. Bull markets gave −0.035R and flat markets −0.07R; only bear markets were positive at 0.245R (t 2.88, 133 trades). The after-cost result sits below zero, which is why costs decide the verdict.
How it was tested
Go long at the close when the 10-day EMA of the close crosses above the 30-day EMA, and exit at the close when it crosses back below.
- Side
- Long
- Its own exit
- At each close after entry, exit at that close if EMA(10) of close is below EMA(30) of close (the cross back down)., 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
- EMAs are computed on daily closing prices
- A cross up means EMA(10) moves from at-or-below to above EMA(30) between consecutive closes
- A cross back means EMA(10) is below EMA(30) at a close
- Entry is at the signal day's close, as the harness requires
- Stop and target were not given; chose a wide 3 x ATR(14) stop and a 6 x ATR(14) target as protective levels
- Time limit set to the 30-bar maximum so the cross-back exit governs where possible
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 | 1,032 | −0.035R | −1.09 | −1.68 · 789d | −0.077R · beats 100% | +0.119R |
| Flat | 246 | −0.070R | −1.10 | −0.94 · 193d | −0.112R · beats 85% | +0.231R |
| Bear | 133 | +0.245R | 2.88 | 2.72 · 102d | −0.060R · beats 100% | +0.317R |
| All | 1,411 | −0.015R | −0.081R | +0.158R |
R is the result per trade in units of the risk taken (entry to stop). Costs are each stock's own trading spread (median 13.4 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
def _ema_series(values, period):
if len(values) < period:
return []
alpha = 2.0 / (period + 1)
cur = sum(values[:period]) / period
out = [cur]
for v in values[period:]:
cur = alpha * v + (1 - alpha) * cur
out.append(cur)
return out
class Ema1030CrossoverLong:
name = "ema_10_30_crossover_long"
description = "Long when EMA(10) crosses above EMA(30) at the close; exit when EMA(10) is below EMA(30)."
def __init__(self, fast: int = 10, slow: int = 30, atr_period: int = 14,
stop_mult: float = 3.0, target_mult: float = 6.0,
min_bars: int = 60) -> None:
self._fast = fast
self._slow = slow
self._atr_period = atr_period
self._stop_mult = stop_mult
self._target_mult = target_mult
self._min_bars = max(min_bars, slow + 2)
def _fast_slow(self, bars):
closes = [float(b.close) for b in bars]
f = _ema_series(closes, self._fast)
s = _ema_series(closes, self._slow)
return f, s
def scan(self, ticker: str, bars: list[Bar]) -> Candidate | None:
if len(bars) < self._min_bars:
return None
f, s = self._fast_slow(bars)
if len(s) < 2 or len(f) < 2:
return None
# f is aligned to end of bars; s likewise
f_now, f_prev = f[-1], f[-2]
s_now, s_prev = s[-1], s[-2]
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="EMA(10) crossed above EMA(30) at the close.",
)
def exit_now(self, ticker: str, bars: list[Bar], entry: Decimal,
side: str, bars_held: int) -> bool:
if side != "buy":
return False
if len(bars) < self._slow:
return False
f, s = self._fast_slow(bars)
if not f or not s:
return False
return f[-1] < s[-1]
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.