Divergence EA BB
This EA detects divergence between price and an oscillator indicator (likely RSI or MACD) combined with Bollinger Bands for entry filtering. It opens trades when divergence signals a potential reversal, using the Bollinger Bands to confirm overbought or oversold conditions. The variant with pip-based SL/TP provides fixed risk management while the alert version only notifies without placing trades.
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.64% | -0.56% | 1.83% | 8 | 75.00% | — | — | — | — | Too few trades |
| GBPUSD | -0.11% | -0.10% | 2.24% | 16 | 56.20% | -0.04 | -0.05 | 2 | −$0.68 | Reliable |
| USDJPY | -1.54% | -1.34% | 2.92% | 14 | 42.90% | -0.71 | -0.53 | 4 | −$11.04 | Reliable |
| XAUUSD | -38.77% | -33.32% | 49.10% | 12 | 41.70% | -0.86 | -0.79 | 4 | −$323.09 | Reliable |
Profitable on 0 of 3 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 Mean Reversion EAs with a reliable result on the same market: GBPUSD: better than 59% of 32 · USDJPY: better than 34% of 32 · XAUUSD: better than 29% of 31
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| GBPUSD | 46% | +0.87% 2025-11 | -1.92% 2026-01 |
| USDJPY | 38% | +0.47% 2025-12 | -1.33% 2026-02 |
| XAUUSD | 23% | +15.11% 2026-07 | -25.44% 2026-01 |
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 is divergence trading, where a new price high/low not confirmed by the oscillator signals a potential trend reversal. Entry conditions: go long on bullish divergence (price lower low + indicator higher low) and go short on bearish divergence (price higher high + indicator lower high), with Bollinger Bands confirming extreme price levels as an additional filter. Exit conditions use fixed pip-based stop loss and take profit values, with stops placed beyond the divergence extremum and take profit set according to a risk-reward ratio. Position sizing employs fixed lots or balance-proportional lots, with some variants potentially supporting trailing stops. Money management relies on the dual confirmation of Bollinger Band contraction and divergence to filter false signals, but lacks dynamic position adjustment based on volatility or account equity drawdown limits.
Strengths
- Divergence is a high-probability reversal signal; Bollinger Band filter improves entry quality
- Fixed SL/TP makes risk controllable and easy to backtest and optimize
- Multiple file variants indicate ongoing iterative strategy improvement
Weaknesses
- Divergence detection generates false signals in choppy markets leading to frequent losses
- Fixed pip stops ignore volatility changes and can be easily swept during high-volatility periods
- Lacks maximum drawdown protection and position reduction after consecutive losses
Possible improvements
- Add ATR-based dynamic SL/TP to automatically adjust risk parameters based on market volatility
- Add multi-timeframe confirmation requiring higher timeframe trend alignment before entry
Risk assessment
Overall risk: Medium
- Fixed stops not adapted to volatility, high-volatility sessions may trigger stops frequently
- Divergence detection algorithm may have repainting or lag issues making signals unreliable
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
OscillatorPeriod | 14 | Oscillator period (RSI or MACD) |
BB_Period | 20 | Bollinger Bands period |
BB_Deviation | 2.0 | Bollinger Bands standard deviation multiplier |
StopLoss_Pips | 30 | Stop loss in points |
TakeProfit_Pips | 60 | Take profit in points |
LotSize | 0.1 | Fixed trading lot size |
Divergence_Lookback | 50 | Divergence detection lookback period |
Timeframe | H1 | Trading timeframe |
Similar Mean Reversion EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.