Bollinger Band Reversal EA Template for MetaTrader 5
The Bollinger Band reversal is one of the most reliable mean reversion strategies in forex trading. This free EA template enters when price touches the upper or lower Bollinger Band and targets a return to the mean. It uses BB(20,2) with ATR-based risk management, optimized for the London session. Build it in AlgoStudio without coding, customize the parameters, and export a production-ready MQL5 Expert Advisor in minutes.
What Is a Bollinger Band Reversal Strategy?
A Bollinger Band reversal strategy uses Bollinger Bands to identify when price has moved too far from its average and is likely to snap back. Bollinger Bands consist of three lines: a middle band (a simple moving average, typically 20 periods) and an upper and lower band placed 2 standard deviations away. When price touches or pierces the outer bands, it is statistically extended and more likely to revert toward the middle.
This is a mean reversion approach \u2014 it assumes that extreme price moves are temporary and that price will return to its average. The trade-off is a moderate win rate (45\u201355%) with smaller individual winners, because you are targeting the middle band rather than riding a trend. The strategy is profitable when applied to range-bound markets where price regularly oscillates between the bands.
Bollinger Bands automatically adapt to market volatility. In volatile markets, the bands widen, requiring a larger move to trigger a signal. In calm markets, the bands narrow, capturing smaller mean reversion moves. This self-adjusting behavior makes the strategy robust across different market conditions without constant parameter tuning.
How This EA Template Works
The London session filter (08:00\u201317:00 GMT) ensures you trade during the most liquid hours when spreads are tightest and mean reversion patterns are most reliable. ATR-based stop losses adapt to current volatility \u2014 wider stops when the market is volatile, tighter stops in calm conditions.
The strategy performs best in range-bound and consolidating markets where price regularly bounces between the bands. It underperforms during strong trending moves where price can ride along the upper or lower band for extended periods. Adding an ADX filter (only trade when ADX < 25, confirming no strong trend) is a common improvement to avoid these “band walking” periods.
Default Parameters
These defaults work well on range-bound pairs (EURGBP, AUDNZD) on H1. All parameters are exported as input variables so you can optimize them in the MT5 Strategy Tester.
| Parameter | Value | Type |
|---|---|---|
| BB Period | 20 | Bollinger Band |
| BB Deviation | 2.0 | Bollinger Band |
| Stop Loss | 1.5x ATR(14) | ATR-based |
| Take Profit | 2:1 R:R | Risk-reward |
| Session | London (08:00–17:00 GMT) | Timing |
| Max Trades/Day | 3 | Risk |
| Position Sizing | 1% risk per trade | Risk |
How to Build This EA Without Coding
1. Create a new project in AlgoStudio
Sign up for free (no credit card required) and click “New Project”. Name your project “BB Reversal Strategy” and open the visual builder canvas.
2. Add timing and indicator blocks
Drag a Trading Sessions block onto the canvas and select the London session (08:00\u201317:00 GMT). Add a Bollinger Bands block \u2014 set the period to 20 and deviation to 2.0. Connect it to the timing block. The BB block provides upper band, lower band, and middle band values automatically.
3. Add trade execution and risk management
Add Place Buy and Place Sell blocks. Connect a “Price crosses below Lower Band” condition to the Buy block, and “Price crosses above Upper Band” to the Sell block. Add Stop Loss (set to 1.5x ATR with period 14), Take Profit (set to 2:1 risk-reward ratio), position sizing (1% risk per trade), and Max Trades Per Day (3).
4. Export, backtest, and optimize
Click Export to generate a .mq5 file. Load it into MetaTrader 5 and backtest on EURGBP H1 with at least 2 years of historical data. Use the MT5 Strategy Tester optimizer to find the best BB settings \u2014 try periods from 15\u201330 and deviations from 1.5\u20132.5. Demo trade for 1\u20133 months before going live.
Optimization Tips
Test different deviation levels
The standard 2.0 deviation is a solid default, but 1.5 and 2.5 are worth testing. Lower deviation (1.5) generates more frequent signals with a lower win rate per trade. Higher deviation (2.5) triggers less often but each signal is more reliable because price is genuinely overextended. Match the deviation to your risk tolerance.
Add an ADX filter to avoid trends
The biggest risk for mean reversion strategies is entering against a strong trend. Adding an ADX block with a threshold below 25 ensures you only take trades when the market is range-bound. This filters out “band walking” scenarios where price rides along the upper or lower band during strong trends.
Consider the middle band as a profit target
Instead of a fixed risk-reward ratio, you can target the middle Bollinger Band (the 20 SMA) as your take profit level. This is the natural mean reversion target and often produces a higher win rate. Test both approaches in backtesting to see which gives better risk-adjusted returns on your chosen pair.