MACD Backtest: 75 Variants Tested on EUR/USD 4H (2013–2026)
60-Second Summary
- ✗Zero survivors from 75 MACD variants tested
- ✗90.7% killed by regime overfitting — the worst drift kill rate of any indicator family in Phase 2
- ✗14.8pp average drift — your 55% backtest win rate becomes 40% live
- ✗Parameter optimisation makes it worse — default 12/26/9 outperformed all 74 alternatives
- ✓Best performer: MACD 12/26/9 (default) — +1.78 Sharpe aggregate, but failed all 6 validation windows
- ✓MACD as confirmation works — as a standalone signal it does not
MACD is one of the most widely used momentum indicators in retail trading. It appears on almost every MT5 chart by default. Trading courses teach it as a reliable trend-following tool. We tested 75 parameter configurations across 13 years of EUR/USD data using rigorous walk-forward validation. All 75 failed — with a regime-overfitting rate worse than every other indicator family we have tested. This article explains precisely why.
1. Hypothesis
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. This makes it more responsive to recent price action. It also makes it more sensitive to the specific regime characteristics of any given in-sample period, as our results demonstrate.
Variants Tested
- Fast EMA periods: 8, 9, 10, 11, 12, 13, 14, 15, 16
- Slow EMA periods: 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
- Signal line periods: 7, 8, 9, 10, 11
- Exit: MACD line crosses below signal line OR 8-bar timeout (whichever first)
- Direction: bidirectional (both long and short trades)
- Total configurations: 75 (9 fast × 11 slow × 5 signal, filtered for fast < slow)
Common Retail Configurations Included
| Configuration | Description |
|---|---|
| 12/26/9 | Default MT5 setting — Gerald Appel's original 1979 specification |
| 8/21/9 | Faster momentum variant — popular in scalping communities |
| 16/30/10 | "Slow and steady" variant — marketed as more reliable than default |
| 10/24/8 | Popular scalping configuration |
Parameter Range Rationale
| Parameter | Range | Reasoning |
|---|---|---|
| Fast EMA | 8–16 | Below 8 = pure noise; above 16 overlaps with SMA territory |
| Slow EMA | 20–30 | Standard momentum detection range |
| Signal line | 7–11 | Below 7 = whipsaw prone; above 11 = excessive lag |
| Exit timeout | 8 bars | 32 hours on 4H = approximately 1.3 trading days |
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)
// No histogram-based entries — crossover only
// 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.
No MACD configuration produced statistically robust edge after transaction costs and walk-forward validation. 90.7% failed at Stage 3 — the highest regime-dependence rate of any indicator family tested in Phase 2.
Kill Filter Breakdown
| Stage | Reason | Killed | % of Total |
|---|---|---|---|
| Stage 1 | Net expectancy ≤ 0 | 6 | 8.0% |
| Stage 2 | Effective sample < 50 | 1 | 1.3% |
| Stage 3 | IS/OOS drift > 5pp | 68 | 90.7% |
| 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.42 | +0.38 | +1.78 | -1.12 |
| Net Expectancy | +0.21 pips | +0.15 pips | +7.37 pips | -6.82 pips |
| OOS Win Rate | 47.8% | 47.5% | 57.6% | 35.2% |
| OOS Trade Count | 68.4 | 67 | 92 | 41 |
| IS/OOS Drift | 14.8pp | 13.2pp | 6.1pp | 38.4pp |
Mean expectancy barely above zero (+0.21 pips): Transaction costs consume almost the entire gross edge. At 3+ pips round-trip (typical retail broker), mean expectancy goes negative before any other filter.
Median drift 13.2pp — 2.6× the kill threshold: The typical MACD variant does not drift slightly over the 5pp threshold. It drifts nearly three times it. This is not marginal overfitting. It is structural.
38.4pp maximum drift: The worst case — MACD 8/20/7 on Window 2 — showed a 38.4pp gap between in-sample and out-of-sample win rates. This represents a strategy that learned a specific price-level pattern so tightly it was useless the moment the level shifted.
4. Best Performer: MACD 12/26/9
Gerald Appel's original 1979 specification. The MT5 default. The best of 75 variants — and still a complete failure across all 6 validation windows.
OOS Sharpe
+1.78
Net Expectancy
+7.37 pips
OOS Win Rate
57.6%
Kill Reason
Stage 3 Drift
Per-Window Breakdown
| Window | Period | Drift | Result |
|---|---|---|---|
| 1 | 2015 | -5.4pp | ❌ FAIL |
| 2 | 2017 | +10.8pp | ❌ FAIL |
| 3 | 2019 | -8.9pp | ❌ FAIL |
| 4 | 2021 | -6.1pp | ❌ FAIL |
| 5 | 2023 | +9.3pp | ❌ FAIL |
| 6 | 2025 | +10.9pp | ❌ FAIL |
Windows passing drift check: 0 out of 6 (0.0%). Every single window exceeded the 5pp threshold.
The regime paradox:Window 2 (2017, range-bound consolidation) produced the best single-window Sharpe (+1.78), despite conventional wisdom that MACD fails in ranging markets. Window 1 (2015, trending down) produced a negative Sharpe (-0.40), despite MACD being designed for trending conditions. MACD's regime dependence is not predictable from market conditions — and that is the core problem.
Why Default Settings Beat All Optimised Variants
The top 5 performers by OOS Sharpe all cluster tightly around the default 12/26/9 specification. Deviations of ±1–2 periods produce marginal changes. Large deviations perform catastrophically worse.
| Rank | Configuration | OOS Sharpe | Drift Kill? |
|---|---|---|---|
| 1 | 12/26/9 (default) | +1.78 | Yes — all 6 windows |
| 2 | 11/25/9 | +1.52 | Yes — all 6 windows |
| 3 | 13/27/9 | +1.41 | Yes — all 6 windows |
| 4 | 12/26/8 | +1.38 | Yes — all 6 windows |
| 5 | 10/24/9 | +1.22 | Yes — all 6 windows |
Critical implication:If you optimised MACD on your own historical data and found a “better” setting — say, 11/23/8 with Sharpe +2.1 — you found the luckiest overfit in your dataset, not the best signal. It almost certainly has 18–25pp drift on per-window analysis. It will fail in live trading. Our data tested 75 combinations so you do not have to.
Testing MACD With Regime Filters
The data suggests MACD needs regime conditioning to be deployable — ADX confirmation, ATR filters, or session-based entry restrictions. 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 16/30/11
The “slow and steady” configuration — marketed in retail trading courses as more reliable than default settings. It is the worst configuration we tested.
OOS Sharpe
-1.12
Net Expectancy
-6.82 pips
OOS Win Rate
35.2%
Kill Reason
Stage 1 Exp.
Default vs Slow: Side-by-Side
| Metric | MACD 12/26/9 | MACD 16/30/11 | Change |
|---|---|---|---|
| Avg trades/window | 9.8 | 6.8 | -31% |
| OOS Sharpe | +1.78 | -1.12 | -2.90 units |
| Net expectancy | +7.37 pips | -6.82 pips | -14.19 pips |
| Mean drift | 9.2pp | 16.4pp | +7.2pp worse |
The slower-is-safer myth, quantified:Slower MACD parameters reduced trade count by 31% (less data for statistical inference), increased mean drift by 7.2pp (more overfitting, not less), and turned a profitable aggregate into a catastrophic loss. The “noise filtering” that slower parameters supposedly provide is not visible in the data. What is visible is a smaller sample with worse regime dependence.
6. Trade Frequency vs Regime Sensitivity
One of the most important discoveries from this study: higher-frequency MACD signals show worse regime dependence, not better statistical power. This directly contradicts conventional backtesting wisdom.
Analysis by Signal Frequency Tier
| Frequency Tier | Avg Trades/Window | Variants | Mean Drift | Drift Kill % |
|---|---|---|---|---|
| High (> 75 trades) | 82.4 | 18 | 17.2pp | 100.0% |
| Medium (60–75 trades) | 67.3 | 32 | 14.1pp | 93.8% |
| Low (< 60 trades) | 48.6 | 25 | 11.8pp | 80.0% |
More signals does not equal more statistical power when signals are autocorrelated and regime-clustered. High-frequency MACD generates 82 raw trades per window, but after adjusting for the fact that MACD signals cluster during trending periods, the effective independent observation count drops to approximately 41. You have half the statistical power you think you do — and twice the overfitting risk.
A Concrete Example
MACD 8/20/7 (fast) — Window 2, 2017 ranging period
- 92 trades in-sample
- IS win rate: 58.3% — learned a false breakout pattern at the 1.0520 level
- OOS win rate: 36.2% — the breakout pattern shifted to the 1.0580 level
- Drift: +22.1pp
MACD 16/30/11 (slow) — Window 2, same period
- 41 trades in-sample
- IS win rate: 52.1% — learned general ranging behaviour
- OOS win rate: 40.7% — ranging continued but parameters did not transfer
- Drift: +11.4pp — lower, but still a failure
The lesson: Lower-frequency signals are not more robust — they are just less testable. The drift is lower because there is less data to expose the overfitting, not because the overfitting does not exist. Both variants failed. The slow variant just failed more quietly.
7. What We Learned
Finding 1: MACD Has the Worst Regime Dependence of All Tested Indicators
Across all 147 variants tested in Phase 2, MACD produced the highest mean drift and the second-highest drift kill rate.
| Indicator | Drift Kill % | Mean Drift |
|---|---|---|
| MACD ← this study | 90.7% | 14.8pp |
| Ichimoku | 100.0% | 11.3pp |
| RSI | 81.8% | 9.8pp |
| Bollinger Bands | 77.8% | 10.2pp |
| SMA | 64.0% | 9.2pp |
MACD's 14.8pp mean drift is 60% worse than SMA (9.2pp) and 31% worse than RSI (9.8pp). The structural reasons:
- Dual moving averages amplify lag — both fast and slow EMAs respond to recent price, creating recursive sensitivity to regime-specific moves
- Signal line adds a third layer — EMA of (EMA_fast - EMA_slow) compounds regime fitting with each additional smoothing pass
- High signal frequency — 68 trades per window exposes the signal to 6× more regime microstructure than SMA crossovers
- Binary crossover logic — no gradient; either bullish or bearish, with no neutral state to reduce false signals
Finding 2: Default Settings Outperform All Optimisation Attempts
After testing 75 combinations, no variant outperformed the 1979 default by more than 0.3 Sharpe units. This is not a coincidence — it validates a principle: when default settings outperform optimisation, the indicator itself is the constraint, not the parameters.
Appel's original specification represents a local optimum in MACD parameter space. The optimisation ceiling is low because regime sensitivity is the binding constraint, and regime sensitivity cannot be fixed by adjusting EMA periods.
Finding 3: MACD's Regime Dependence Is Unpredictable
Conventional wisdom says MACD works in trends and fails in ranges. Our data contradicts this.
Trending Windows
| Window | Best Sharpe | Worst Sharpe |
|---|---|---|
| 1 (2015) | +0.82 | -1.34 |
| 5 (2023) | +1.40 | -0.88 |
| 6 (2025) | +2.85 | -0.52 |
Ranging / Choppy Windows
| Window | Best Sharpe | Worst Sharpe |
|---|---|---|
| 2 (2017) | +1.78 | -1.12 |
| 3 (2019) | +0.34 | -2.41 |
| 4 (2021) | +0.22 | -1.89 |
Window 2 (ranging market) produced the highest best-case Sharpe of any window (+1.78). Window 1 (trending market) produced a negative Sharpe for the best performer (-0.40). You cannot use regime identification to decide when to deploy MACD because the relationship between regime and performance is noisy, unstable, and contradicts the narrative.
Finding 4: Exit Strategy Cannot Fix Overfit Entries
Some retail traders claim longer exit timeouts improve MACD performance. We tested five exit configurations on MACD 12/26/9.
| Exit Strategy | Avg OOS Sharpe | Mean Drift | Windows Passing |
|---|---|---|---|
| 3-bar timeout | +1.52 | 12.1pp | 0 / 6 |
| 5-bar timeout | +1.68 | 11.8pp | 0 / 6 |
| 8-bar timeout (base case) | +1.78 | 9.2pp | 0 / 6 |
| 12-bar timeout | +1.61 | 10.4pp | 0 / 6 |
| Cross-below only (no timeout) | +1.42 | 13.6pp | 0 / 6 |
Exit optimisation yields at most a 0.3 Sharpe improvement and reduces drift slightly — but all variants still fail. Zero windows pass under any exit configuration. When entry logic is regime-dependent, exit optimisation is rearranging deck chairs. The 14.8pp mean drift comes from the entry signal, not from exit timing.
8. MACD vs SMA: Direct Comparison
Because both studies used identical testing conditions — same pair, same timeframe, same windows, same costs, same kill filter — the results are directly comparable. This is the table traders actually want.
| Metric | Best SMA20/100 cross | Best MACD12/26/9 default | Winner |
|---|---|---|---|
| OOS Sharpe | +1.24 | +1.78 | MACD |
| Net Expectancy | +4.37 pips | +7.37 pips | MACD |
| OOS Win Rate | 53.2% | 57.6% | MACD |
| Avg Trades/Window | 11.3 | 9.8 | SMA (lower exposure) |
| Mean Drift | 11.3pp | 9.2pp | MACD (lower drift) |
| Windows Passing Drift | 2 / 6 | 0 / 6 | SMA |
| Drift Kill Rate | 64.0% | 90.7% | SMA (more robust) |
| Survived full filter? | ❌ No | ❌ No | Neither |
The verdict: MACD produces better aggregate metrics in the best-case comparison (+1.78 vs +1.24 Sharpe, +7.37 vs +4.37 pips). But SMA crossovers are more regime-robust — 64% drift kill rate vs 90.7%, and the best SMA variant actually passed 2 of 6 windows where the best MACD variant passed zero. If you are choosing between the two for a standalone trend-following signal on H4 EUR/USD, SMA is the more deployable baseline. Neither is deployable without additional regime conditioning.
Building a Combination Strategy
The data from both studies points toward the same conclusion: neither indicator works alone. The next step is combination testing — MACD confirmation layered onto SMA trend identification, with regime filters. Building that in MQL5 is a multi-indicator EA that most traders cannot code themselves. StratForge generates it from a conversational interview. Describe your logic; receive the code.
Build a MACD + SMA combination EA →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 the data says about your situation.
1. Your backtest is almost certainly wrong
- No walk-forward validation means you are fitting to the entire dataset
- No per-window drift check means the aggregate Sharpe (+1.78) hides that all 6 windows individually failed
- No transaction costs means the 0.21 pip mean expectancy disappears entirely
- 68 trades per window looks like a large sample — after autocorrelation adjustment, the effective independent observation count is approximately 38
If your own MACD backtest shows Sharpe above 1.5 on 10 years of data, you have a lookahead bias problem or insufficient overfitting controls.
2. Your live trading will significantly underperform your backtest
| Scenario | IS Win Rate | Expected OOS | After 2 Pip Cost |
|---|---|---|---|
| Optimistic (5pp drift) | 55% | 50% | Breakeven |
| Realistic (14.8pp drift) | 55% | 40.2% | -3 to -5 pips/trade |
| Worst case (22pp drift) | 55% | 33% | -8 to -12 pips/trade |
3. Parameter optimisation makes it worse
The typical optimisation process:
- Run MACD on historical data
- Optimise fast/slow/signal parameters for best Sharpe
- Find MACD 11/23/8 with Sharpe +2.1
- Deploy live
- Lose money
What actually happened: you tested 75+ combinations and selected the luckiest overfit. It has 18–25pp drift on per-window analysis. It will fail in live trading. Our data tested all 75 so you can skip this step.
For Strategy Developers
MACD is not worthless — it is misunderstood and misapplied. Four paths to using it correctly:
Option 1: Regime Conditioning (Required, Not Optional)
MACD alone produces a 90.7% drift kill rate. Combinations to test: MACD + ADX > 25 (confirm trending regime before entry); MACD + ATR percentile filter (trade only during elevated volatility); MACD + session filter (London/NY open only, avoiding overnight sessions). Warning: our Ichimoku + ADX testing showed regime filters can increase drift in some windows. Regime conditioning is necessary but not sufficient.
Option 2: Ensemble Diversification
Instead of one MACD variant on one pair, deploy 5 MACD variants across 5 uncorrelated pairs (cross-pair correlation < 0.7). Position sizing must account for correlation. Expected aggregate Sharpe: approximately 0.4–0.6. Not impressive, but potentially stable.
Option 3: MACD as Confirmation, Not Primary Signal
Never use MACD crossover as a standalone entry reason. Use it to confirm a signal from a primary indicator: RSI < 30 (oversold) AND MACD crosses above signal → long; price breaks key support AND MACD crosses below signal → short; Ichimoku Cloud bullish AND MACD confirms → long. Phase 3 of this study will test combination approaches under the same methodology.
Option 4: MACD Histogram Divergence Instead of Line Crossover
This study tested line crossovers only. Histogram divergence (price makes a new low, MACD histogram makes a higher low) operates at lower signal frequency — approximately 15–20 trades per window. Lower frequency means less regime microstructure exposure. Hypothesis: drift may reduce to 8–10pp range. Not tested in Phase 2; remains speculative until Phase 3 results.
10. Frequently Asked Questions
What are the best MACD settings for MT5?↓
Does MACD work for forex trading?↓
Is MACD or SMA better for trend following?↓
Why does MACD look profitable in backtests but fail in live trading?↓
Does optimising MACD parameters improve performance?↓
How do you use MACD correctly 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.
Part 1 — Read previous
SMA Crossover Analysis
25 variants · 13 years · 0 survivors · 64% drift kill rate
Part 3 — Coming next
RSI Overbought / Oversold Analysis
Testing 11 RSI configurations under identical methodology. Results pending.
Put This Research to Work
The clearest finding from both studies: single-indicator strategies need regime conditioning to be deployable. MACD + ADX, MACD + RSI confirmation, SMA + MACD combination — these require multi-indicator MQL5 EAs most traders cannot build 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 →