Macd diver and rsi mt5
This EA trades based on MACD divergence combined with RSI filtering on MT5. It detects bullish and bearish divergences between price and the MACD indicator, then uses RSI levels to confirm entry signals before opening positions.
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 | -0.27% | -0.23% | 0.57% | 114 | 45.10% | -0.60 | -0.47 | 7 | −$0.27 | Reliable |
| GBPUSD | +0.68% | +0.59% | 0.44% | 122 | 49.60% | 1.21 | 1.54 | 6 | +$0.54 | Reliable |
| USDJPY | -0.18% | -0.16% | 0.49% | 127 | 58.30% | -0.40 | -0.37 | 4 | −$0.15 | Reliable |
| XAUUSD | +4.11% | +3.38% | 10.20% | 125 | 52.40% | 0.56 | 0.40 | 7 | +$3.51 | 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 54% of 68 · GBPUSD: better than 68% of 66 · USDJPY: better than 54% of 68 · XAUUSD: better than 57% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 54% | +0.18% 2026-04 | -0.24% 2026-02 |
| GBPUSD | 69% | +0.26% 2026-07 | -0.22% 2026-06 |
| USDJPY | 54% | +0.14% 2026-04 | -0.21% 2025-12 |
| XAUUSD | 46% | +7.84% 2026-08 | -4.84% 2026-02 |
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's core concept is MACD divergence detection: a bullish divergence forms when price makes a lower low but MACD makes a higher low, signaling a long entry; a bearish divergence forms when price makes a higher high but MACD makes a lower high, signaling a short entry. Entry conditions require RSI as a confirming filter — long signals need RSI near oversold levels, and short signals need RSI near overbought levels, enhancing the reliability of divergence signals. Exit conditions typically involve fixed take-profit and stop-loss levels, and may also close positions on opposing divergence signals. Position sizing uses a fixed lot approach without dynamic adjustment or account-balance-proportional sizing. Money management is relatively weak, lacking advanced risk controls such as trailing stops or partial closes, relying primarily on the accuracy of divergence signals for risk control.
Strengths
- MACD divergence is a classic and well-validated reversal trading strategy with high theoretical reliability
- RSI as a secondary filter effectively reduces false divergence signals that lead to incorrect entries
- Clear and understandable strategy logic with adjustable parameters suitable for optimization across different market conditions
- The dual confirmation mechanism of divergence detection combined with momentum filtering reduces trade frequency but improves signal quality
Weaknesses
- Divergence detection can generate numerous false signals in ranging markets, leading to consecutive losses
- Fixed lot trading lacks dynamic position sizing and cannot adjust risk exposure based on market volatility
- No explicit trailing stop mechanism means profitable positions may lose most gains during pullbacks
- RSI filter parameters require re-optimization for different instruments and timeframes, limiting generalization ability
Possible improvements
- Add trailing stop functionality to protect profitable positions and reduce profit givebacks
- Introduce ATR-based dynamic stop-loss and take-profit that self-adjusts based on market volatility
- Add divergence strength quantification to filter weak divergence signals and improve win rate
- Implement account-risk-proportional position sizing to replace the fixed lot approach
Risk assessment
Overall risk: Medium
- Fixed lot trading cannot automatically reduce risk exposure during account drawdown
- Divergence signals may trigger frequently in ranging markets leading to consecutive losses
- Stop-loss set to 0 or relying on default values poses risk of large single-trade losses
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
LotSize | 0.1 | Fixed trading lot size |
MACD_FastEMA | 12 | MACD fast EMA period |
MACD_SlowEMA | 26 | MACD slow EMA period |
MACD_SignalSMA | 9 | MACD signal SMA period |
RSI_Period | 14 | RSI indicator period |
RSI_Overbought | 70 | RSI overbought level |
RSI_Oversold | 30 | RSI oversold level |
StopLoss | 0 | Stop loss in points |
TakeProfit | 0 | Take profit in points |
Timeframe | H1 | Trading timeframe |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.