MACD crossover, backtested
MACD is the difference between two exponential moving averages, and its signal line is an average of that difference, which makes the famous crossover a moving-average crossover with an extra layer of smoothing. That is worth knowing before you run it, because it sets the expectation: this behaves like a trend system, not like a timing oracle, and the standard 12/26/9 settings are a convention from the 1970s rather than a result anyone optimised.
Over December 2021 to December 2026, this setup lost to simply buying and holding. €10,000 became €11,237 (+12.4%), against €17,405 (+74.0%) for buy & hold, over 53 trades, with a worst fall of 13.8%. One stock, one stretch of history.
The rules, exactly
- Buy at the close on the day the MACD line crosses above its signal line.
- Sell at the close on the day it crosses back below. Long or flat, never short.
- Standard settings: 12-day fast EMA, 26-day slow EMA, 9-day signal. Every one of the three is editable below.
- 0.1% commission and 0.05% slippage per side.
Screens for: $10B+ · 1M+ shares a day (applies when step 1 is set to the whole US market). See a ranked pool in the momentum screener.
What to watch for
MACD crossings are frequent in a sideways market and each one costs the spread twice, so a result that looks flat before fees can be clearly negative after them, which is why fees are on by default here. It is also the same underlying signal as a moving-average crossover, so running this beside the golden cross on the same ticker tells you more than running either alone. Treat 12/26/9 as one parameter set out of many, not as the strategy.
Before you trust any backtest
- Five years of daily closes: not a full market cycle.
- Your broker’s fees and slippage may differ.
- Few trades means the result says almost nothing. Check the trade count first.
Change the rules themselves in the full backtester.
The other prebuilt strategies
- Buy the dip: Buy any day that falls 2% or more, and sell ten trading days later. No filter, no stop.
- Golden Cross: Hold while the 50-day average is above the 200-day; step aside when it crosses back under.
- 20/50 cross: The same crossover idea as the golden cross, on faster averages: 20-day over 50-day.
- RSI 30/70: The textbook RSI trade: buy when the 14-day RSI drops under 30, sell when it clears 70.
- One-year high: Buy a close above the highest close of the past year; exit on a 50-day closing low.
- RSI-2 reversion: Buy an uptrending market when the 2-day RSI washes out below 10; sell the bounce above 70.
- Trend pullback: In a long uptrend, buy the dip that reclaims the 50-day average, a bounce off the trend.
- Impulse pullback: A fresh 6/18 EMA cross marks a brand-new trend; buy its first small dip as it resumes.
- Donchian breakout: Buy a 20-day high the way the Turtles did; exit on a 10-day low or the 2R target.
- Bollinger reversion: Buy a close under the lower 20-day band; sell the snap back to the middle band.