EA_MACD_FixedPSAR
This EA uses MACD crossover signals confirmed by EMA trend direction to open buy/sell positions. It offers three trailing stop modes: none, fixed trailing stop, and a custom Parabolic SAR-inspired trailing stop. Positions are closed either on MACD signal reversal or by trailing stop/take profit/stop loss levels.
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 | +28.73% | +24.54% | 21.76% | 124 | 52.00% | 0.82 | 1.32 | 6 | +$26.12 | Reliable |
| GBPUSD | +13.12% | +11.31% | 34.88% | 122 | 49.60% | 0.49 | 0.38 | 7 | +$12.83 | Reliable |
| USDJPY | +44.43% | +37.64% | 27.97% | 121 | 59.50% | 1.00 | 1.59 | 6 | +$36.72 | Reliable |
| XAUUSD | -100.00% | -100.00% | 100.00% | 31 | 48.40% | -0.06 | -1.00 | 4 | −$613.65 | Account stopped out |
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 99% of 68 · GBPUSD: better than 100% of 66 · USDJPY: better than 100% of 68 · XAUUSD: better than 0% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 62% | +13.19% 2026-04 | -13.38% 2026-03 |
| GBPUSD | 54% | +27.63% 2026-02 | -17.31% 2026-06 |
| USDJPY | 62% | +27.17% 2026-04 | -22.59% 2026-08 |
| XAUUSD | 33% | +93.89% 2025-11 | -100.00% 2026-01 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: High
- Hit a stop-out in our backtest (equity below 10%) on XAUUSD
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 trades based on MACD momentum crossovers, with entry conditions requiring the MACD main line to cross the signal line while exceeding the open level threshold, confirmed by EMA trend direction (rising EMA for buys, falling EMA for sells). Exit conditions include MACD reverse crossover exceeding the close level threshold, fixed trailing stop, and a custom Parabolic SAR-style trailing stop. Position sizing uses a fixed lot size with no dynamic lot adjustment based on account equity or risk percentage. Money management only checks free margin before opening a position, lacking maximum position limits or drawdown controls. The Parabolic SAR trailing stop is the EA's core feature, computing SAR values internally rather than calling the indicator, dynamically adjusting stops based on new price highs/lows, but the reset logic is flawed—initializing trailing max at the entry price rather than actual price extremes, and failing to adjust the stop when price doesn't make new highs.
Strengths
- Three trailing stop modes built-in, with Parabolic SAR trailing effectively locking in profits
- MACD signals combined with EMA trend filter, avoiding counter-trend trades
- Clean code structure using MQL5 standard trade libraries, OOP design for maintainability
- Includes parameter validation logic checking if TP/SL meet exchange minimum distance requirements
Weaknesses
- Fixed lot sizing without dynamic position management, no risk-based lot adjustment
- Parabolic SAR trailing stop initialization is flawed, using entry price instead of actual price extremes
- No spread filter, potential slippage losses in volatile or high-spread market conditions
- No new bar check, logic executes every tick potentially causing duplicate signals
- Take profit calculation missing NormalizeDouble, may cause precision issues
Possible improvements
- Add dynamic position sizing based on account risk percentage instead of fixed lots
- Fix Parabolic SAR trailing stop initialization to use actual price highs/lows instead of entry price
- Add new bar detection to prevent redundant trade logic execution on the same bar
- Add spread filter to pause opening positions when spread is excessively wide
Risk assessment
Overall risk: Medium
- Parabolic SAR trailing stop doesn't adjust when price fails to make new highs, potentially failing to protect profits in sideways markets
- No new bar detection may cause duplicate trade logic triggers within the same bar
- Fixed lot sizing may create excessive risk exposure on high-leverage accounts
- Take profit calculation not normalized may cause order rejection
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
InpLots | 1.0 | Trading lot size |
InpTakeProfit | 200 | take profitpoints (pip) |
InpStopLoss | 50 | stop losspoints (pip) |
InpTrailngMode | FixedPSAR | Trailing stop mode: None/Fixed/Parabolic SAR |
InpTrailingStop | 30 | Fixed trailing stoppoints(pip) |
InpPSAR_Step | 0.02 | Parabolic SAR acceleration factor step |
InpPSAR_Maximum | 0.2 | Parabolic SAR acceleration factor maximum |
InpMACDOpenLevel | 3 | MACDentry signal threshold(pip) |
InpMACDCloseLevel | 2 | MACDexit signal threshold(pip) |
InpMATrendPeriod | 26 | EMA trend determination period |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.