Trend & pullback
MACD Signal Crossover with EMA Trend Filter
A filtered MACD crossover that acts after the histogram and signal relationship is final, using EMA(200) to restrict countertrend trades.
- Category
- Trend & pullback
- Timeframes
- H4
- Pairs
- EURUSD, GBPUSD, USDJPY, AUDUSD
- Test status
- Mechanical bar tests completed; profitability unverified

How the rule works
MACD subtracts two exponential averages, while its signal smooths that difference. The positive/negative zero-line test and EMA200 filter reduce countertrend crosses, but add lag. In MT5 the standard signal line is an SMA; importing rules from software that uses an EMA signal without adjustment changes the signal dates. A close-confirmed cross can still reverse on the next bar.
Setup
- At close, accept a long setup only if close is above EMA(200), MACD main was at/below its signal on the prior bar and is above it now; require the MACD main line above zero.
Indicators
- MT5 MACD(12,26,9), Close: EMA fast/slow and SMA signal
- EMA(200), Close
- EMA(50), Close
- MT5 ATR(14)
Long entry
- Buy at the next H4-bar ask. A setup that crosses during the current bar but reverses before the close is ignored.
Short entry
- For a short, require close below EMA(200), a completed downward main-versus-signal cross, and MACD main below zero; sell at the next-bar bid.
Stop loss
- Initial stop is below the signal bar’s low for a buy or above its high for a sell, with a 2×ATR(14) maximum distance; skip oversized stops.
Exit
- Exit long after main MACD crosses to/below signal or Close crosses to/below EMA50; short uses the inverse. Execute at the next quote. Time exit: 15 completed H4 holding bars.
- After each close, long trailing SL = max(previous SL, highest completed high since entry − 2 × current ATR14); short SL = min(previous SL, lowest completed low since entry + 2 × current ATR14). A standing stop can execute intrabar.
Risk and position size
- Risk 0.50% equity once per signal. Size from the worse of the price stop and expected spread; do not count an indicator exit as a guaranteed stop.
Costs and execution
- MT5 MACD display conventions can differ from chart packages. Confirm its parameters and applied price, calculate only closed bars, and model bid/ask spread, slippage and swaps.
When the method can fail
- Avoid MACD crosses near zero in a sideways EMA(200), and periods just before data releases. Lag makes this vulnerable to late entries and reversal gaps.
Worked example
- Hypothetical bullish cross: previous main/signal values are 0.0008/0.0009; current values 0.0011/0.0010. With price above EMA200, next ask 1.1002 and signal low 1.0960, the 42-pip stop is eligible if ATR14 is at least 0.0021. MT5’s SMA signal can place this event on a different bar than an EMA-signal MACD.
Historical test results
No tested pair meets the complete research-screen criterion. Positive cells alone do not qualify the strategy.
24 mechanical runs across 4 pairs on H4. Decisions use completed strategy bars; fills use native ICMarketsEU-Demo M15 Bid candles with explicitly modelled costs. Full window: 1 January 2025–18 September 2026. Each row starts with an independent USD10,000 account.
| Pair | Period | Costs | Trades | Net return | Profit factor | Max drawdown | Ambiguous bars |
|---|---|---|---|---|---|---|---|
| EURUSD | combined | base | 41 | -7.98% | 0.522 | 8.17% | 0 |
| EURUSD | combined | stress | 41 | -8.73% | 0.4736 | 8.89% | 0 |
| GBPUSD | combined | base | 40 | -5.67% | 0.5386 | 6.57% | 0 |
| GBPUSD | combined | stress | 39 | -6.26% | 0.4836 | 6.81% | 0 |
| USDJPY | combined | base | 48 | +10.35% | 1.8094 | 4.01% | 0 |
| USDJPY | combined | stress | 48 | +7.35% | 1.5712 | 4.12% | 0 |
| AUDUSD | combined | base | 50 | -5.82% | 0.6254 | 7.68% | 0 |
| AUDUSD | combined | stress | 50 | -7.52% | 0.5204 | 8.67% | 0 |
Show 2025 and 2026 separately
| Pair | Period | Costs | Trades | Net return | Profit factor | Max drawdown | Ambiguous bars |
|---|---|---|---|---|---|---|---|
| EURUSD | 2025 | base | 23 | -4.49% | 0.4293 | 6.24% | 0 |
| EURUSD | 2025 | stress | 23 | -5.05% | 0.3723 | 6.61% | 0 |
| EURUSD | 2026 | base | 18 | -3.65% | 0.6063 | 6.49% | 0 |
| EURUSD | 2026 | stress | 18 | -3.99% | 0.5555 | 6.47% | 0 |
| GBPUSD | 2025 | base | 30 | -6.26% | 0.3417 | 6.57% | 0 |
| GBPUSD | 2025 | stress | 29 | -6.56% | 0.2934 | 6.73% | 0 |
| GBPUSD | 2026 | base | 10 | +0.60% | 1.2029 | 2.62% | 0 |
| GBPUSD | 2026 | stress | 10 | +0.28% | 1.0932 | 2.60% | 0 |
| USDJPY | 2025 | base | 29 | +8.18% | 2.0933 | 4.01% | 0 |
| USDJPY | 2025 | stress | 29 | +6.85% | 1.9013 | 4.12% | 0 |
| USDJPY | 2026 | base | 19 | +2.01% | 1.4116 | 3.16% | 0 |
| USDJPY | 2026 | stress | 19 | +0.51% | 1.1037 | 3.02% | 0 |
| AUDUSD | 2025 | base | 32 | -5.09% | 0.5007 | 6.13% | 0 |
| AUDUSD | 2025 | stress | 32 | -5.96% | 0.4208 | 6.74% | 0 |
| AUDUSD | 2026 | base | 18 | -0.86% | 0.8486 | 3.69% | 0 |
| AUDUSD | 2026 | stress | 18 | -1.58% | 0.722 | 3.71% | 0 |
Costs, execution and qualification criteria
Base: Spread 1.0 pip for majors; 1.5 EURGBP/EURJPY; 2.0 GBPJPY/AUDNZD. USD7/100k round-trip commission; 0.1 pip adverse market/stop slippage per fill. Financing=max(negative current native swap,0.2pip/night), no positive credit, native triple-swap day.
Stress: Double base spread; 0.3 pip adverse slippage/fill; same commission; double max(negative current native swap,0.5pip/night).
Research candidate only if a pair has >=30 trades in EACH calendar subperiod, positive net returns and PF >=1.10 in EACH subperiod under BOTH cost scenarios, and combined maximum drawdown <=15% under BOTH scenarios. Not a statistical profitability proof. All pairs and failures are retained.
Profit factor is the sum of positive net trade results divided by the absolute sum of negative results. Drawdown includes adverse M15 intrabar marks. The end of each test window liquidates open positions, so separate subperiod returns do not add exactly to the continuous-window return.
- Bar execution, not a real-tick MT5 Strategy Tester run. Same-bar ambiguity is treated adversely and counted.
- Current swap snapshot is an explicit stress assumption, not historical funding.
- One isolated USD10,000 account per strategy/pair, leverage ceiling30, broker minimum lots and steps. Results cannot be added into one portfolio.
- 2026 is a later evaluation slice, not untouched independent out-of-sample evidence; no parameter optimization was performed.
- Retrospective scheduled MT5 calendar may contain revised release times. UTC export normalized to NY-close broker clock against BLS releases.
- General discretionary event avoidance is fixed as high-impact events for either currency +/-30min. IDs1/17 next60min; ID20 next120min. ID13 UK bank holidays excluded. Subjective trend quality, unscheduled events and all-country holiday/session quality are not fully quantifiable; these are documented mechanical variants.
- Sparse broker histories are reported with shorter effective coverage and are ineligible for a candidate label.
- Native indicator parity: ATR, SMA, RSI, MACD, bands, stochastic, WPR, CCI and Ichimoku matched native buffers on EURUSD H4 within rounding tolerance; Wilder ADX matched the MetaQuotes ADXW example. EMA200 seed residual at 1,000 bars was 0.000000715, falling below 0.0000000001 after 2,000 bars.
- Built-in iSAR differs from the published MetaQuotes example on reversal bars. ID9 therefore uses actual built-in iSAR buffers exported by MT5, joined by timestamp, not the approximate Python SAR. Native GBPUSD/USDJPY SAR history needs 300 warm-up bars from January 2025, so those rows start later and cannot pass the full-period screen.
- 37 automated checks passed: execution gaps, short ask prices, ambiguous stop/target candles, partial commissions, pending expiry, time zones, rule regression cases and monthly portfolio no-lookahead/cash costs.
Interpretation: these are mechanical bar-model tests, not verified real-tick or live performance. Price rules were held fixed; subjective market-quality exclusions remain outside the mechanical model. Strategy adaptation requires a new test.
Download all test metrics and assumptions (JSON) · Download simulated trade logs and reproducible research code · Broker commission and swap documentation
Execution conventions
- Bar [0] is forming; [1] is the most recently completed bar. Unless explicitly stated otherwise, indicators use Close with zero plot shift and signals use completed bars. EMA is exponential, SMA is arithmetic and MT5 ATR is its native true-range average. Use at least 300 completed warm-up bars; a longer rule-specific requirement takes priority.
- A close-based signal is executed at the first available quote after the close, never retrospectively at the signal close. Buy at ask, sell at bid; close longs at bid and shorts at ask. A standing stop or target can fill within a bar. A gap through a stop fills at the first executable price, which can be worse than the stop.
- R means the initial entry-to-protective-stop distance, fixed at entry. Convert that distance into account-currency loss using the symbol tick size and loss-side tick value. Lots = cash risk / loss per lot, rounded down to the broker volume step. Round prices to the trade tick and recheck risk plus minimum stop/freeze distances before submitting. Budget commission and slippage separately; skip if minimum size exceeds the risk limit.
- Use one position per symbol and no averaging down. A trailing stop only tightens after a completed bar and becomes active on the next quote. The entry bar is holding bar one; a time exit executes on the quote after the specified holding bar closes. When a hard stop and a close-based exit compete, the stop already active takes precedence. With OHLC-only data, assume stop before target if both can occur in one bar; tick data is needed to resolve the order.
- The article defines the price rule. Any discretionary news exclusion changes the tested variant and must be recorded in advance. Map broker timestamps to the named London/New York time zone using historical daylight-saving offsets; do not assume a fixed UTC offset. Include spread, commission, slippage, overnight financing and triple-swap days in a profitability test.
Adapt and test your version
- Treat these inputs as a reproducible starting specification. Choose a currency pair, session and holding period that match the time you can monitor the market, then record any changes to indicator periods, thresholds, stop distance or exits as a new version.
- Change one hypothesis at a time. Reserve a later period and additional pairs for evaluation before looking at their results. Include your account’s actual trading and financing costs, compare small parameter changes, and forward-test on demo. A selected profitable window does not validate the strategy or its modified version.
Reproduce the chart in MT5
- Open EURUSD on H4. Add the indicators listed above through Insert → Indicators; use Close and zero shift unless a different setting is specified. The Data Window displays exact values for the selected completed candle.
- Compare the signal candle with the required earlier bars before moving forward. Use the crosshair to read prices and times. For custom channels, session levels or Supertrend, reproduce the formula in this guide and check the calculation before relying on an external indicator.
- Draw entry, initial SL and target only after a candle has satisfied every condition. Label planned levels as plans; they do not demonstrate a historical fill. The featured chart is genuine historical MT5 context and is not a trade-performance report.
Sources
- MT5 Help: MACD — Indicator/platform definition; not strategy performance.
