ResearchPart 2 of the MT5 Indicator Backtest Series

MACD Backtest: 75 Variants Tested on EUR/USD 4H (2013–2026)

By Marcus Vector·(corrected June 21, 2026)·15 min read·← Part 1: SMA Results

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.

ParameterValues PresentNotes
Fast period8, 9 onlyPlan specified 8–16; not executed
Slow period20–30 (11 values)Full range, but only paired with fast=8
Signal period7–11 (5 values)Full range, as planned
Exit (bars)8 onlyFixed 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

PairEUR/USD
Timeframe4-hour (H4)
PeriodJanuary 1, 2013 – April 18, 2026 (13.3 years)
Total bars22,193
Windows validated450 (75 variants × 6 windows)
Transaction costs2.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

WindowIS PeriodOOS Period
12013–20152015
22015–20172017
32017–20192019
42019–20212021
52021–20232023
62023–20252025

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

StageReasonKilled% of Total
Stage 1Net expectancy ≤ 000.0%
Stage 2Effective sample < 5000.0%
Stage 3IS/OOS drift > 5pp (any window)75100.0%
Stage 4Binomial test fail00.0% (never reached)
Stage 5Sharpe variance00.0% (never reached)

Performance Summary (All 75 Variants)

MetricMeanMedianBestWorst
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 Rate48.0%48.2%50.7%44.6%
OOS Trade Count410404465370
Mean |Drift| (per variant)9.0pp9.0pp7.5pp10.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

WindowPeriodDriftResult
12015+10.27pp❌ FAIL
22017+18.77pp❌ FAIL
32019-16.23pp❌ FAIL
42021+7.81pp❌ FAIL
52023+3.95pp✅ PASS
62025+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.

RankConfigurationOOS SharpeNet Exp.Windows Passing
19/21/11+1.24+5.55 pips1 / 6
29/20/11+1.23+5.46 pips0 / 6
39/23/10+1.20+5.21 pips2 / 6
49/22/11+1.18+4.92 pips3 / 6
59/22/9+1.17+4.94 pips0 / 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

MetricMACD 9/21/11 (best)MACD 8/20/7 (worst)
Avg trades/window62.577.5
OOS Sharpe+1.24+0.52
Net expectancy+5.55 pips+1.11 pips
Own mean |drift|10.55pp7.82pp
Windows passing1 / 62 / 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

TercileAvg Trades/WindowVariantsMean DriftDrift Kill %
Low frequency63.8259.37pp100.0%
Medium frequency67.7259.00pp100.0%
High frequency73.6258.59pp100.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.

IndicatorVariantsDrift Kill %Mean Drift
MACD ← this study75100.0%8.99pp
Bollinger Bands9100.0%8.49pp
Ichimoku2777.8%8.67pp
Ichimoku+ADX955.6%12.85pp
RSI1154.5%15.63pp
SMA2544.0%17.35pp
ATR Breakout2722.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.

WindowAvg SharpeBest SharpeWorst SharpeVariants Exceeding 5pp
1 (2015)+0.33+0.99-0.1471 / 75
2 (2017)+2.33+3.20+1.6375 / 75
3 (2019)-1.23-0.62-1.8775 / 75
4 (2021)+0.35+0.85-0.1246 / 75
5 (2023)+1.59+3.02+0.3837 / 75
6 (2025)+2.13+2.81+0.9444 / 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.

MetricBest SMA30/200 crossBest MACD9/21/11Winner
OOS Sharpe+0.86+1.24MACD
Net Expectancy+23.56 pips+5.55 pipsSMA (larger edge/trade)
OOS Win Rate62.4%50.7%SMA
Avg Trades/Window5.762.5SMA (lower exposure)
Family Mean Drift17.35pp8.99ppMACD (lower drift)
Windows Passing (this variant)0 / 61 / 6MACD
Family Drift-Kill Rate44.0%100.0%SMA (more robust as a family)
Survived full filter?❌ No❌ NoNeither

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?
MACD 9/21/11 ranked highest of 75 configurations with an OOS Sharpe of +1.24 and net expectancy of +5.55 pips. It still failed: 5 of its 6 validation windows exceeded the drift threshold. The textbook default of 12/26/9 was never tested in this sweep — the fast period only ever took values of 8 or 9.
Does MACD work for forex trading?
Not as a standalone signal, based on this data. All 75 configurations failed walk-forward validation. The best-performing variant only passed 1 of 6 validation windows, and no configuration in the grid passed more than 3 of 6.
Is MACD or SMA better for trend following?
It depends which metric you weight. MACD's best variant has a higher Sharpe (+1.24 vs +0.86) and lower family-wide mean drift (8.99pp vs 17.35pp), but failed the drift check in 100% of its 75 variants versus 44% for SMA. SMA's best variant generated far higher net expectancy per trade by trading roughly 11x less often. Neither survived the full filter standalone.
Why does MACD look profitable in aggregate but fail walk-forward validation?
Aggregate metrics average across windows that move in opposite directions. The best variant's +1.24 aggregate Sharpe blends a window that drifted +18.77pp with one that drifted -16.23pp. The edge is real on average but unstable window to window — exactly what a per-window drift check is built to catch.
Does optimising MACD parameters improve performance?
It changes the Sharpe ratio, not the outcome. Sharpe ranged from +0.52 to +1.24 across all 75 combinations, and every one failed the drift check regardless. Longer signal-line smoothing raised average Sharpe monotonically but left drift essentially unchanged, in a narrow 8.3–9.6pp band across every signal period tested.
How should MACD be used in MT5?
Based on this data, not as a standalone entry signal. It likely performs better as a confirmation tool layered onto a primary signal with regime context — a combination not tested in this study and still a hypothesis rather than a validated recommendation.

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 →