MACD Backtest: 75 Variants Tested on EUR/USD 4H (2013–2026)
60-Second Summary
- ✗Zero survivors from 75 MACD variants tested
- ✗100% killed by IS/OOS drift — every single variant exceeded the threshold in at least one window
- ✗No variant passed more than half the windows — the best any configuration achieved was 3 of 6
- ✗The textbook default (12/26/9) was never tested — the sweep only ever used fast periods of 8 or 9
- ✓Best performer: MACD 9/21/11 — +1.24 Sharpe aggregate, but failed 5 of 6 validation windows
- ✓Every variant was profitable net of costs — mean Sharpe +0.92 across all 75 — and every one still failed
MACD is one of the most widely used momentum indicators in retail trading. It appears on almost every MT5 chart by default. We tested 75 parameter configurations across 13 years of EUR/USD data using rigorous walk-forward validation. All 75 failed — every one of them at the IS/OOS drift stage, the highest drift-kill rate of any indicator family we have tested to date. This article explains precisely why, using only the figures that exist in the underlying sweep data.
1. Hypothesis & Parameter Grid
MACD (Moving Average Convergence Divergence) measures the relationship between two exponential moving averages. The hypothesis: when the MACD line crosses above the signal line, price momentum is accelerating upward; when it crosses below, momentum is decelerating or reversing.
Unlike SMA crossovers, which operate on raw price, MACD operates on the difference between two EMAs — adding a layer of momentum sensitivity and a third smoothing pass via the signal line.
What Was Actually Tested
Before stating this, it was verified directly against the source sweep data rather than assumed from the original test plan. The result does not match what was originally specified — the planning brief called for fast periods 8 through 16; only 8 and 9 were actually executed.
| Parameter | Values Present | Notes |
|---|---|---|
| Fast period | 8, 9 only | Plan specified 8–16; not executed |
| Slow period | 20–30 (11 values) | Full range, but only paired with fast=8 |
| Signal period | 7–11 (5 values) | Full range, as planned |
| Exit (bars) | 8 only | Fixed across all 75 variants, not swept |
The grid is not a full cross-product. Fast=8 pairs with all 11 slow values (55 variants). Fast=9 pairs only with slow 20–23 (20 variants). 55 + 20 = 75.
The textbook 12/26/9 MACD parameterisation was never tested in this sweep.Zero variants in the dataset use fast=12, slow=26, signal=9. If you are looking for “the standard MACD backtest,” it is not in this dataset, and no performance number for it appears anywhere in this article.
Total configurations: 75 (bidirectional, both long and short trades). Direction: MACD line crosses above signal line → long; crosses below → short. Exit: MACD line crosses back, or an 8-bar timeout, whichever comes first.
2. Methodology
Identical methodology to Part 1 (SMA crossover study). This allows direct, apples-to-apples comparison between indicator families.
Data Specification
| Pair | EUR/USD |
| Timeframe | 4-hour (H4) |
| Period | January 1, 2013 – April 18, 2026 (13.3 years) |
| Total bars | 22,193 |
| Windows validated | 450 (75 variants × 6 windows) |
| Transaction costs | 2.0 pips round-trip (1.5 pip spread + 0.5 pip slippage) |
Signal Logic
// MACD Calculation
MACD line = EMA(close, fast) - EMA(close, slow)
Signal line = EMA(MACD line, signal_period)
// Entry
Long: MACD line crosses above signal line → enter next bar open
Short: MACD line crosses below signal line → enter next bar open
// Exit
MACD line crosses back (reversal), OR 8-bar timeout — whichever first
Walk-Forward Windows
| Window | IS Period | OOS Period |
|---|---|---|
| 1 | 2013–2015 | 2015 |
| 2 | 2015–2017 | 2017 |
| 3 | 2017–2019 | 2019 |
| 4 | 2019–2021 | 2021 |
| 5 | 2021–2023 | 2023 |
| 6 | 2023–2025 | 2025 |
Why the same methodology matters: Using identical windows, costs, and kill filter across both studies means MACD and SMA results are directly comparable. Any performance difference reflects the indicator, not the testing conditions.
3. Results
75 variants tested. 0 survivors.
Every MACD configuration cleared the profitability bar and the sample-size bar. Every single one then failed the IS/OOS drift check — 100% of the 75 variants, the highest drift-kill rate of any indicator family tested to date.
Kill Filter Breakdown
| Stage | Reason | Killed | % of Total |
|---|---|---|---|
| Stage 1 | Net expectancy ≤ 0 | 0 | 0.0% |
| Stage 2 | Effective sample < 50 | 0 | 0.0% |
| Stage 3 | IS/OOS drift > 5pp (any window) | 75 | 100.0% |
| Stage 4 | Binomial test fail | 0 | 0.0% (never reached) |
| Stage 5 | Sharpe variance | 0 | 0.0% (never reached) |
Performance Summary (All 75 Variants)
| Metric | Mean | Median | Best | Worst |
|---|---|---|---|---|
| OOS Sharpe | +0.92 | +0.93 | +1.24 | +0.52 |
| Net Expectancy | +3.39 pips | +3.57 pips | +5.55 pips | +1.11 pips |
| OOS Win Rate | 48.0% | 48.2% | 50.7% | 44.6% |
| OOS Trade Count | 410 | 404 | 465 | 370 |
| Mean |Drift| (per variant) | 9.0pp | 9.0pp | 7.5pp | 10.7pp |
For Mean |Drift|, “Best” is the lowest per-variant average drift and “Worst” the highest — lower is better for this metric, the reverse of the other rows.
Every variant was net-profitable, and it didn't matter: Mean net expectancy across all 75 variants is a solidly positive +3.39 pips after a 2-pip round-trip cost, and mean OOS Sharpe is +0.92. None of that mattered. 100% still failed the per-window drift check.
Drift is bidirectional, not just degradation:The mean absolute drift of ~9 percentage points understates the real swings. The best-performing variant alone ranged from -16.23pp in one window to +18.77pp in another — the strategy doesn't simply get worse out-of-sample, it becomes unpredictable.
4. Best Performer: MACD 9/21/11
Fast=9, slow=21, signal=11. The highest-ranked of all 75 tested variants by OOS Sharpe — and still a failure across 5 of its 6 validation windows.
OOS Sharpe
+1.24
Net Expectancy
+5.55 pips
OOS Win Rate
50.7%
Kill Reason
Stage 3 Drift
Per-Window Breakdown
| Window | Period | Drift | Result |
|---|---|---|---|
| 1 | 2015 | +10.27pp | ❌ FAIL |
| 2 | 2017 | +18.77pp | ❌ FAIL |
| 3 | 2019 | -16.23pp | ❌ FAIL |
| 4 | 2021 | +7.81pp | ❌ FAIL |
| 5 | 2023 | +3.95pp | ✅ PASS |
| 6 | 2025 | +6.29pp | ❌ FAIL |
Windows passing drift check: 1 out of 6 (16.7%) — only Window 5.
The 2017/2019 pattern:Window 2 (2017, a range-bound consolidation year) produced this variant's strongest result (+2.90 Sharpe). Window 3 (2019) produced its only outright loss (-1.04 Sharpe). The same two years show up as extremes across the entire 75-variant grid — see Section 7 — which points to a regime-specific cause rather than something specific to this configuration.
The Top 5 Configurations
The five highest-Sharpe variants all cluster around fast=9 and signal periods of 9–11. None of them passed more than half their validation windows.
| Rank | Configuration | OOS Sharpe | Net Exp. | Windows Passing |
|---|---|---|---|---|
| 1 | 9/21/11 | +1.24 | +5.55 pips | 1 / 6 |
| 2 | 9/20/11 | +1.23 | +5.46 pips | 0 / 6 |
| 3 | 9/23/10 | +1.20 | +5.21 pips | 2 / 6 |
| 4 | 9/22/11 | +1.18 | +4.92 pips | 3 / 6 |
| 5 | 9/22/9 | +1.17 | +4.94 pips | 0 / 6 |
What “optimisation” actually bought here: Across all 75 variants in this grid, the single best result for windows-passing was 3 of 6 — achieved twice, neither time by the highest-Sharpe configuration. No combination of fast, slow, and signal periods in this sweep produced a variant that passed more than half its validation windows.
Testing MACD With Regime Filters
The data suggests MACD needs regime conditioning to be deployable — ADX confirmation, ATR filters, or session-based entry restrictions, none of which were tested in this study. Building that logic into MQL5 code requires knowing the language. StratForge generates the complete EA code for combinations like MACD + ADX through a guided strategy interview — no coding required.
Generate a MACD + filter EA with StratForge →5. Worst Performer: MACD 8/20/7
Fast=8, slow=20, signal=7 — the lowest-fast, lowest-signal configuration in the grid, and also the highest-frequency variant tested (465 OOS trades, the most of any configuration).
OOS Sharpe
+0.52
Net Expectancy
+1.11 pips
OOS Win Rate
44.6%
Kill Reason
Stage 3 Drift
Best vs Worst: Side-by-Side
| Metric | MACD 9/21/11 (best) | MACD 8/20/7 (worst) |
|---|---|---|
| Avg trades/window | 62.5 | 77.5 |
| OOS Sharpe | +1.24 | +0.52 |
| Net expectancy | +5.55 pips | +1.11 pips |
| Own mean |drift| | 10.55pp | 7.82pp |
| Windows passing | 1 / 6 | 2 / 6 |
Worst Sharpe does not mean worst drift: The lowest-ranked variant by Sharpe actually shows a lower own-average drift (7.82pp) than the top-ranked variant (10.55pp), and it passes one more window. Sharpe ranking and drift stability are not the same axis — a configuration can look worse on aggregate return and still be more consistent window to window.
6. Trade Frequency vs Drift
Conventional wisdom says higher-frequency signals should drift more — more trades means more exposure to regime-specific microstructure. We checked this directly against the 75-variant set. It does not hold here.
Drift by Trade-Frequency Tercile
| Tercile | Avg Trades/Window | Variants | Mean Drift | Drift Kill % |
|---|---|---|---|---|
| Low frequency | 63.8 | 25 | 9.37pp | 100.0% |
| Medium frequency | 67.7 | 25 | 9.00pp | 100.0% |
| High frequency | 73.6 | 25 | 8.59pp | 100.0% |
Every tercile fails 100% of the time, so frequency does not predict pass/fail in this dataset — there is no pass/fail variation left to explain. On the magnitude of drift specifically, the relationship runs mildly the opposite way to intuition: the highest-frequency tercile shows slightly lowermean drift (8.59pp) than the lowest-frequency tercile (9.37pp). The effect is small and should not be over-read, but it does not support a “fewer trades, more robust” story.
A Concrete Example
The highest-trade variant in the entire grid (HYP_0012, fast=8/slow=20/signal=7, 465 OOS trades) and the lowest-trade variant (HYP_0056, fast=8/slow=28/signal=11, 370 OOS trades) both have a Window 2 (2017) result on record:
8/20/7 (highest trade count) — Window 2, 2017
- 78 trades in the window
- IS win rate: 40.0%
- OOS win rate: 53.85%
- Drift: +13.85pp
8/28/11 (lowest trade count) — Window 2, 2017
- 60 trades in the window
- IS win rate: 40.5%
- OOS win rate: 61.67%
- Drift: +21.17pp — larger, despite fewer trades
The honest takeaway: In this dataset, trade frequency does not reliably predict drift magnitude in either direction. What does correlate with something is signal-line period — see Section 7 — but it correlates with average Sharpe, not with drift, which stays in a narrow 8.3–9.6pp band regardless of signal period.
7. What We Learned
Finding 1: MACD Has the Highest Drift-Kill Rate of All Tested Indicators
Across all 183 hypotheses tested in the Phase 2 sweep so far, MACD produced the highest drift-kill rate of any family, despite a mid-range mean drift figure.
| Indicator | Variants | Drift Kill % | Mean Drift |
|---|---|---|---|
| MACD ← this study | 75 | 100.0% | 8.99pp |
| Bollinger Bands | 9 | 100.0% | 8.49pp |
| Ichimoku | 27 | 77.8% | 8.67pp |
| Ichimoku+ADX | 9 | 55.6% | 12.85pp |
| RSI | 11 | 54.5% | 15.63pp |
| SMA | 25 | 44.0% | 17.35pp |
| ATR Breakout | 27 | 22.2% | 16.35pp |
MACD's drift-kill rate is more than double SMA's (100% vs 44%) despite a lower mean drift magnitude (8.99pp vs 17.35pp). The plausible explanation — not yet independently verified against the full distribution shape — is that MACD's EMA-smoothed signal produces a narrower, more consistent drift distribution that clusters just above the 5pp line, while SMA's drift is wider and noisier but lands under the threshold more often by chance. This is flagged as an open question, not a confirmed mechanism.
Finding 2: Signal-Line Period Is the Cleanest Relationship in the Data
Average Sharpe rises monotonically from +0.70 at signal=7 to +1.08 at signal=11 — every step up in signal-line smoothing improves average OOS Sharpe, with no exceptions across all five tested values. Both the best and worst performers in the full ranking sit at the extremes of this parameter.
What this finding does not do is fix drift. Mean drift by signal period stays in a narrow 8.3–9.6pp band across all five values, with no meaningful trend. Longer smoothing buys average return, not regime stability.
Finding 3: Regime Dependence Is Consistent Across Configurations, Not Just the Best One
Window 2 (2017) and Window 3 (2019) are unanimous extremes across the entire 75-variant grid — not a quirk of any single configuration.
| Window | Avg Sharpe | Best Sharpe | Worst Sharpe | Variants Exceeding 5pp |
|---|---|---|---|---|
| 1 (2015) | +0.33 | +0.99 | -0.14 | 71 / 75 |
| 2 (2017) | +2.33 | +3.20 | +1.63 | 75 / 75 |
| 3 (2019) | -1.23 | -0.62 | -1.87 | 75 / 75 |
| 4 (2021) | +0.35 | +0.85 | -0.12 | 46 / 75 |
| 5 (2023) | +1.59 | +3.02 | +0.38 | 37 / 75 |
| 6 (2025) | +2.13 | +2.81 | +0.94 | 44 / 75 |
Window 3 (2019) is the only window where every single one of the 75 variants posted a negative bestand worst Sharpe. Window 2 (2017) is the mirror image — every variant positive, and unanimously over the 5pp drift line. A parameter-invariant failure pattern this strong points to the regime itself, not the indicator tuning.
8. MACD vs SMA: Direct Comparison
Both studies used identical testing conditions — same pair, same timeframe, same windows, same costs, same kill filter — so the results are directly comparable. Figures below are recomputed from the same source file for both indicators; the SMA figures supersede an earlier, uncorrected version of the Part 1 comparison.
| Metric | Best SMA30/200 cross | Best MACD9/21/11 | Winner |
|---|---|---|---|
| OOS Sharpe | +0.86 | +1.24 | MACD |
| Net Expectancy | +23.56 pips | +5.55 pips | SMA (larger edge/trade) |
| OOS Win Rate | 62.4% | 50.7% | SMA |
| Avg Trades/Window | 5.7 | 62.5 | SMA (lower exposure) |
| Family Mean Drift | 17.35pp | 8.99pp | MACD (lower drift) |
| Windows Passing (this variant) | 0 / 6 | 1 / 6 | MACD |
| Family Drift-Kill Rate | 44.0% | 100.0% | SMA (more robust as a family) |
| Survived full filter? | ❌ No | ❌ No | Neither |
The verdict: The two metrics genuinely point in different directions. By Sharpe, drift magnitude, and windows-passed for their single best variant, MACD edges ahead. By net expectancy per trade, win rate, and family-wide drift-kill rate, SMA is more robust. Neither survived the full filter. If you are choosing a standalone trend-following signal on H4 EUR/USD, this comparison does not produce a clean winner — it produces two different failure profiles.
9. Why This Matters
For Retail Traders
If you are using MACD based on a trading course, MT5 default settings, or a backtest you ran yourself, here is what this data actually supports.
1. A positive aggregate backtest tells you almost nothing about regime stability
- The best variant in this study is profitable on paper after costs (+5.55 pips net) and still fails 5 of 6 windows
- An aggregate Sharpe of +1.24 is the average of a -16pp drift year and a +19pp drift year — the average hides the instability, it does not resolve it
- Without a per-window check, a single favourable backtest period can look indistinguishable from a robust strategy
2. Parameter optimisation changes the number, not the outcome
Sharpe ranged from +0.52 to +1.24 across all 75 tested combinations. Every single one failed the drift check regardless of where it landed in that range. If you optimise MACD on your own historical data and find a configuration with a better Sharpe than your starting point, this data gives you no reason to expect that improvement to survive walk-forward validation.
For Strategy Developers
MACD is not worthless here — it is unfinished. Paths worth testing, none of them validated in this study:
Option 1: Regime Conditioning
MACD alone produces a 100% drift-kill rate. Untested combinations worth exploring: MACD + ADX trend-strength filter, MACD + ATR percentile filter, MACD + session-based entry restriction. None of these were part of this sweep.
Option 2: MACD as Confirmation, Not Primary Signal
Use MACD crossover to confirm a signal from a primary indicator rather than as the entry trigger itself — for example, requiring a trend filter to agree with crossover direction before entry. A future combination-testing phase of this series will evaluate this directly under the same methodology.
Option 3: MACD Histogram Divergence Instead of Line Crossover
This study tested line crossovers only, with a fixed 8-bar exit. Histogram divergence operates at a different signal frequency and was not tested. This remains a hypothesis, not a finding.
10. Frequently Asked Questions
What was the best MACD configuration in this backtest?↓
Does MACD work for forex trading?↓
Is MACD or SMA better for trend following?↓
Why does MACD look profitable in aggregate but fail walk-forward validation?↓
Does optimising MACD parameters improve performance?↓
How should MACD be used in MT5?↓
11. Next in the Series
This is Part 2 of the MT5 Indicator Backtest Series. Every study uses the same methodology, the same dataset, and the same 5-stage kill filter — making results directly comparable across indicator families.
Put This Research to Work
The clearest finding across both studies: single-indicator strategies need regime conditioning to be deployable, and that conditioning has not yet been tested in this series. Building a multi-indicator MQL5 EA is something most traders cannot code themselves. StratForge generates complete, reviewed EA code from a conversational strategy interview. No coding required. Your own Anthropic API key means you pay Anthropic directly — typically a few cents per generation.
Generate a Custom MACD EA →