EA-2154 · Momentum

MACD Sample

This EA uses MACD histogram crossovers combined with an EMA trend filter to generate buy and sell signals. It implements trailing stop management and take profit targets for position exits. The strategy only enters trades when the MACD signal confirms momentum and the EMA confirms the prevailing trend direction.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryMomentum
RiskMedium
Blow-up riskLow
Rating★★★☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsMACD, EMA
AuthorCopyright 2009-2013, MetaQuotes Software Corp.

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD+4.96%+4.30%3.36%12755.60%1.071.485+$4.21Reliable
GBPUSD+5.83%+5.04%2.55%12449.60%1.062.295+$4.93Reliable
USDJPY-5.73%-5.00%7.71%12455.30%-1.11-0.744−$4.72Reliable
XAUUSD+49.79%+39.64%63.00%12754.00%0.830.796+$41.49Reliable

Profitable on 3 of 4 markets with reliable results.

Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.

Against the other Momentum EAs with a reliable result on the same market: EURUSD: better than 85% of 68 · GBPUSD: better than 94% of 66 · USDJPY: better than 12% of 68 · XAUUSD: better than 77% of 75

Month by month

MarketMonths with a gainBest monthWorst month
EURUSD69%+3.11% 2026-04-2.01% 2026-03
GBPUSD62%+2.60% 2025-12-1.61% 2026-01
USDJPY31%+2.42% 2025-12-2.50% 2026-01
XAUUSD54%+55.05% 2026-02-20.28% 2026-04

From the backtest equity curve, sampled about every two days; only reliable results.

Blow-up risk: No blow-up pattern found

None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.

High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →

Strategy analysis

The core strategy of this EA is based on MACD signal line crossovers for trade entries, with an EMA acting as a trend direction filter. Long entry conditions require: MACD main line below zero, MACD main line crossing above signal line from below, MACD absolute value exceeding the open level threshold, and current EMA greater than previous EMA (confirming uptrend). Short entry conditions are symmetrically opposite: MACD main line above zero, MACD main line crossing below signal line from above, MACD value exceeding the open level threshold, and current EMA less than previous EMA (confirming downtrend). For exits, long positions close when MACD bearish crossover occurs above zero with MACD value above close level; short positions close when MACD bullish crossover occurs below zero with MACD absolute value above close level. Position sizing uses a fixed lot size (InpLots=0.1) with no scaling or position accumulation logic. Money management includes only a free margin check before opening positions, with no maximum drawdown limit or equity protection mechanism. The trailing stop moves the stop loss to follow price once profit exceeds the trailing stop threshold, but no initial stop loss is set on position open.

Strengths

  • Clear strategy logic using the classic MACD crossover with EMA trend filter combination, easy to understand and verify
  • Implements trailing stop functionality to lock in partial profits on winning positions and reduce drawdown risk
  • Includes comprehensive parameter validation (lot size range, take profit/trailing stop vs StopsLevel) preventing abnormal trades from misconfigured inputs
  • Well-structured OOP encapsulation makes the code maintainable and extensible

Weaknesses

  • No initial stop loss is set on position open (SL=0.0), relying solely on trailing stop which can lead to catastrophic losses during sharp market reversals
  • Fixed lot sizing without equity-based or volatility-based position adjustment lacks dynamic money management
  • No new bar detection mechanism; trade logic can trigger on every tick, potentially causing repeated entries or frequent modifications during fast markets
  • No spread filter; in high-spread environments the MACD threshold values may be consumed by spread costs leading to losing trades
  • Positions can be reopened immediately after closing without directional confirmation protection, potentially causing repeated losses in choppy markets

Possible improvements

  • Set an initial stop loss on position open instead of relying solely on trailing stop, to limit maximum per-trade loss
  • Add new bar detection logic to prevent multiple signal triggers within the same bar, reducing unnecessary trading costs
  • Introduce ATR-based dynamic position sizing and threshold settings to adapt the strategy to different market volatility environments

Risk assessment

Overall risk: Medium

  • No initial stop loss on position open exposes unlimited risk in extreme market conditions
  • Fixed lot size without equity adjustment causes risk ratio to increase progressively during consecutive losses
  • Lack of new bar detection and spread filter may lead to frequent trading under unfavorable conditions

Evaluation scores

Code quality4.0
Strategy logic3.0
Risk management2.0
Robustness3.0
Innovation1.0
Documentation3.0
Overall2.7

Parameters

ParameterDefaultDescription
InpLots0.1Fixed lot size
InpTakeProfit50Take profit in points
InpTrailingStop30Trailing stop in points
InpMACDOpenLevel3MACD open signal threshold (points)
InpMACDCloseLevel2MACD close signal threshold (points)
InpMATrendPeriod26EMA trend detection period

Similar Momentum EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.