Divergence + EMA + RSI Close EA
This EA combines divergence detection with EMA trend filtering and RSI momentum confirmation to generate trade signals. It comes in two variants: a buy-only version that opens long positions and a sell-only version that opens short positions, each with corresponding alert-only editions. The strategy enters trades when price divergence aligns with the EMA trend direction and RSI supports the momentum bias, then closes positions on opposing divergence signals or RSI extremes.
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.51% | -0.45% | 5.52% | 139 | 44.60% | -0.08 | -0.09 | 5 | −$0.37 | Reliable |
| GBPUSD | -7.44% | -6.50% | 8.90% | 140 | 38.60% | -1.16 | -0.84 | 8 | −$5.31 | Reliable |
| USDJPY | -4.77% | -4.16% | 8.00% | 138 | 47.10% | -0.83 | -0.60 | 8 | −$3.45 | Reliable |
| XAUUSD | -1.95% | -1.61% | 45.74% | 152 | 47.70% | 0.25 | -0.04 | 5 | −$2.92 | Reliable |
Profitable on 0 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 51% of 68 · GBPUSD: better than 18% of 66 · USDJPY: better than 13% of 68 · XAUUSD: better than 55% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 38% | +3.15% 2026-03 | -2.39% 2026-07 |
| GBPUSD | 38% | +4.60% 2026-03 | -4.13% 2026-02 |
| USDJPY | 46% | +1.53% 2026-01 | -3.71% 2026-09 |
| XAUUSD | 54% | +19.48% 2026-01 | -24.83% 2026-07 |
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 concept of this strategy is to capture trend reversals or continuations based on divergence between price and indicators. Entry conditions require three signals to align simultaneously: first, a bullish or bearish divergence must be detected between price and the indicator; second, price must be on the favorable side of the EMA (above EMA for buys, below EMA for sells); third, RSI must be in a zone that supports the entry momentum. Exit conditions include closing positions when an opposing divergence signal is detected, and closing when RSI reaches overbought or oversold extreme zones. Position sizing uses fixed lots with no dynamic lot adjustment mechanism. Money management lacks explicit stop-loss and take-profit settings, relying on signal-based exits rather than preset price targets to control risk. The overall strategy logic is clear, using divergence as the core signal, EMA as a trend filter, and RSI as a momentum confirmer, with triple filtering reducing false signal probability. However, the absence of hardcoded stop-losses means the EA carries significant open-ended risk if signals fail to trigger exits in a timely manner.
Strengths
- Triple signal filtering (divergence + EMA + RSI) effectively reduces false signal probability
- Separate buy/sell versions keep logic simple, avoid signal conflicts, and allow independent optimization
- Divergence detection is a relatively reliable reversal signal, and combining it with trend filtering improves win rate
Weaknesses
- Lacks hardcoded stop-loss, which can cause massive losses during extreme market conditions
- Fixed lot sizing with no dynamic position adjustment based on account risk
- Divergence detection algorithm may have latency, causing late entry timing
Possible improvements
- Add hardcoded stop-loss and take-profit parameters to provide risk floor protection
- Implement dynamic position sizing that adjusts lots based on ATR or account balance
Risk assessment
Overall risk: Caution
- No hardcoded stop-loss; relying on signal-based exits may be too slow during violent market moves
- Fixed lots without account equity proportional sizing can lead to excessive risk exposure
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
EMA_Period | 200 | EMA period for trend filtering |
RSI_Period | 14 | RSI period for momentum confirmation |
RSI_Overbought | 70 | RSI overbought threshold for exit |
RSI_Oversold | 30 | RSI oversold threshold for exit |
LotSize | 0.1 | Fixed trading lot size |
Divergence_Lookback | 20 | Divergence detection lookback period |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.