Long/Short ExpertMACD
This EA is a MACD-based long/short trading expert that extends the standard MQL5 CExpert framework with a custom CLongShortExpertModified class. It generates trade signals from MACD crossover logic and allows the user to restrict trading to long-only, short-only, or both directions. The EA uses no trailing stop and no money management module, relying solely on fixed take-profit and stop-loss levels for trade exits.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | +5.89% | +5.10% | 2.41% | 132 | 52.70% | 1.37 | 2.44 | 5 | +$4.76 | Reliable |
| GBPUSD | +1.97% | +1.71% | 3.49% | 130 | 48.10% | 0.39 | 0.56 | 4 | +$1.71 | Reliable |
| USDJPY | -7.40% | -6.46% | 10.39% | 130 | 46.90% | -1.38 | -0.71 | 5 | −$5.69 | Reliable |
| XAUUSD | -57.18% | -50.38% | 83.69% | 138 | 48.20% | -0.09 | -0.68 | 6 | −$39.93 | Reliable |
Profitable on 2 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 90% of 68 · GBPUSD: better than 77% of 66 · USDJPY: better than 7% of 68 · XAUUSD: better than 37% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 77% | +3.05% 2026-04 | -1.64% 2026-09 |
| GBPUSD | 54% | +1.88% 2026-04 | -1.76% 2026-01 |
| USDJPY | 38% | +1.56% 2025-12 | -3.59% 2026-01 |
| XAUUSD | 38% | +53.65% 2026-07 | -31.99% 2026-05 |
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 strategy concept of this EA is based on momentum signals from the MACD indicator, using crossover of the fast and slow MACD lines to determine market direction and generate entry signals. Entry conditions are determined by the CSignalMACD module: a long position is opened when the MACD main line crosses above the signal line, and a short position when it crosses below, with the Inp_Allowed_Positions parameter controlling whether long, short, or both directions are permitted. Exit conditions use fixed take-profit and stop-loss values set by Inp_Signal_MACD_TakeProfit and Inp_Signal_MACD_StopLoss respectively, with no trailing stop functionality (CTrailingNone). Position sizing is not dynamically managed since the EA uses CMoneyNone, meaning lot size must be manually configured in the EA properties. Money management is entirely absent, so the trader must manually control risk exposure as the EA does not auto-calculate position sizes based on account balance or risk ratios. Overall, this is a cleanly structured but relatively basic MACD momentum-following system.
Strengths
- Built on the standard MQL5 CExpert framework with clean, well-structured code that is easy to understand and maintain
- Supports position direction control (Inp_Allowed_Positions), offering high flexibility to adapt to different market views
- Uses standard library modules (CSignalMACD, etc.) with a modular design that makes it easy to replace or extend signal, trailing, and money management components
Weaknesses
- No money management module at all (CMoneyNone), so position sizes are never auto-adjusted based on account risk
- No trailing stop mechanism (CTrailingNone), meaning profitable trades cannot lock in floating gains through trailing stops
- Stop-loss (20) is smaller than take-profit (50) but the ratio is modest, and MACD signals can generate frequent false signals in ranging markets leading to consecutive losses
- Lacks spread filtering and new bar detection, which may result in unfavorable fills in low-liquidity or high-spread environments
Possible improvements
- Add a dynamic money management module (e.g., MoneyFixedMargin or MoneyFixedRisk) to auto-calculate position sizes based on account balance and risk ratio
- Add a trailing stop module (e.g., TrailingFixedPips or TrailingMA) to lock in more profit during trending moves
- Add spread filtering and new bar detection logic to avoid opening positions during high spreads or repeated entries within the same bar
Risk assessment
Overall risk: Medium
- No money management module means position sizing relies entirely on manual configuration, posing over-leveraging risk
- No trailing stop means profitable trades can turn into losses when the trend reverses
- MACD tends to generate false signals in ranging markets, leading to frequent stop-outs
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Inp_Expert_Title | Long/Short ExpertMACD | EA title name |
Inp_Allowed_Positions | BOTH_POSITION | Allowed position direction (long only/short only/both) |
Inp_Signal_MACD_PeriodFast | 12 | MACD fast line period |
Inp_Signal_MACD_PeriodSlow | 24 | MACD slow line period |
Inp_Signal_MACD_PeriodSignal | 9 | MACD signal line period |
Inp_Signal_MACD_TakeProfit | 50 | Take profit in points |
Inp_Signal_MACD_StopLoss | 20 | Stop loss in points |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.