Bollinger Band Two MA and Zig-Zag
This EA combines Bollinger Bands with two moving averages and a Zig-Zag indicator to identify mean reversion trading opportunities. It enters trades when price touches Bollinger Band extremes and confirms with moving average alignment and Zig-Zag swing detection. The system aims to capture price reversals back to the mean after overextension.
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 | -3.82% | -3.33% | 4.68% | 23 | 26.10% | -1.23 | -0.82 | 4 | −$16.60 | Reliable |
| GBPUSD | +0.30% | +0.26% | 3.17% | 23 | 34.80% | 0.10 | 0.10 | 3 | +$1.33 | Reliable |
| USDJPY | -2.42% | -2.10% | 5.28% | 28 | 28.60% | -0.72 | -0.46 | 8 | −$8.64 | Reliable |
| XAUUSD | -28.76% | -24.43% | 39.81% | 24 | 37.50% | -0.71 | -0.72 | 4 | −$119.82 | Reliable |
Profitable on 1 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 Mean Reversion EAs with a reliable result on the same market: EURUSD: better than 33% of 30 · GBPUSD: better than 62% of 32 · USDJPY: better than 25% of 32 · XAUUSD: better than 32% of 31
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 38% | +0.96% 2026-06 | -1.61% 2026-04 |
| GBPUSD | 38% | +1.79% 2026-02 | -0.92% 2026-06 |
| USDJPY | 38% | +2.02% 2026-08 | -2.09% 2026-04 |
| XAUUSD | 38% | +21.48% 2026-09 | -23.73% 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 core is mean reversion, using Bollinger Bands to gauge price deviation as the primary entry criterion. When price touches the upper or lower band, it is considered an overextension signal, confirmed by the alignment direction of two moving averages. The Zig-Zag indicator identifies swing highs and lows to filter out false breakouts and market noise, improving entry signal reliability. Entry conditions require confluence of Bollinger Band touch, moving average direction confirmation, and Zig-Zag reversal, forming a multi-layered filtering mechanism. Exit occurs when price reverts to the middle band or on moving average crossover, with stop-loss set to control per-trade risk. Position sizing uses fixed lots or balance-proportional methods without complex money management modules. Overall strategy logic is clear but depends on precise parameter tuning and may require re-optimization across different market cycles.
Strengths
- Multi-indicator confluence filtering reduces false signals and improves entry quality
- Mean reversion strategy performs well in ranging markets with clear and understandable logic
- Zig-Zag assists in identifying key turning points, effectively filtering market noise
- Bollinger Bands dynamically adapt to market volatility with strong self-adaptability
Weaknesses
- Mean reversion strategy prone to consecutive losses in strong trending markets
- Three indicator parameters require precise coordination with high over-optimization risk
- Default stop-loss and take-profit values are zero, creating risk of trading without protection
- Lacks money management and dynamic position adjustment mechanisms with limited risk control
Possible improvements
- Add a money management module supporting dynamic position sizing based on risk percentage
- Implement trend filtering to pause or reverse trading logic during strong trending conditions
- Add reasonable default values and mandatory checks for stop-loss and take-profit to prevent unprotected trading
Risk assessment
Overall risk: Caution
- Default stop-loss and take-profit are zero, potentially opening unprotected positions
- Mean reversion trades against the trend in trending markets with significant risk
- Multi-indicator parameter optimization may lead to curve fitting
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Bands_Period | 20 | Bollinger Bands period parameter |
Bands_Deviation | 2.0 | Bollinger Bands standard deviation multiplier |
FastMA_Period | 10 | Fast MA period |
SlowMA_Period | 50 | Slow MA period |
ZigZag_Depth | 12 | Zig-Zag depth parameter |
ZigZag_Deviation | 5 | Zig-Zag deviation parameter |
ZigZag_Backstep | 3 | Zig-Zag backstep parameter |
LotSize | 0.1 | Trading lot size |
StopLoss | 0 | Stop loss in points |
TakeProfit | 0 | Group take profit target amount (in currency) |
Similar Mean Reversion EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.