Range Breakout EA Template for MetaTrader 5
The Range Breakout strategy trades the break of a defined price range — typically the Asian session consolidation broken at the London or New York open. This free EA template uses customizable time-based ranges with a breakout buffer, ATR-based risk management, and optional volume confirmation. Best for GBPUSD, EURUSD, and USDJPY on H1 to H4 timeframes. Build it in AlgoStudio without coding and export a production-ready MQL5 Expert Advisor in minutes.
What Is a Range Breakout Strategy?
A Range Breakout strategy identifies a period of price consolidation (the range) and then enters a trade when price breaks decisively above or below that range. The logic is simple: consolidation represents indecision, and a breakout signals that one side (buyers or sellers) has won. The strategy aims to catch the momentum that follows this resolution.
The most common approach is the Asian session breakout — measuring the high and low of the quiet Asian trading hours (00:00-08:00 GMT) and then trading the breakout when the London session opens with its higher volume and volatility. This is a well-documented edge in forex because Asian sessions consistently produce tighter ranges that European and American sessions then break.
Range Breakout strategies have clear, rule-based entries that make them ideal for automation. The entry is objective (price crosses a defined level), the stop loss is logical (opposite side of the range or ATR-based), and the take profit follows a fixed risk-reward ratio. This makes the strategy easy to backtest, optimize, and trust.
How This EA Template Works
The template calculates the high and low of the Asian session (00:00-08:00 GMT by default) and places pending orders above and below the range. When one order triggers, the opposite is automatically cancelled. This “cancel opposite on fill” feature prevents being whipsawed into two opposing positions.
The breakout buffer (default 2 pips) ensures you don't enter on marginal breaks where price barely touches the range boundary. Combined with the candle-close confirmation mode, this filters out most false breakouts caused by spread widening or brief price spikes.
Default Parameters
These defaults are optimized for the Asian-to-London breakout on GBPUSD and EURUSD. All parameters are exported as input variables so you can optimize them in the MT5 Strategy Tester.
| Parameter | Value | Type |
|---|---|---|
| Range Type | Custom Time (Asian) | Session |
| Range Start | 00:00 GMT | Timing |
| Range End | 08:00 GMT | Timing |
| Breakout Buffer | 2 pips | Filter |
| Stop Loss | 1.5x ATR(14) | ATR-based |
| Take Profit | 2:1 R:R | Risk-reward |
| Cancel Opposite | Yes | Order management |
| 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 “Range Breakout Strategy” and open the visual builder canvas.
2. Add the Range Breakout block
Drag a Range Breakout price action block onto the canvas. Set the range method to “Custom Time” with start hour 00:00 and end hour 08:00 (Asian session). Connect it to Buy and Sell condition nodes, then add Stop Loss and Take Profit nodes. Set the breakout buffer to 2 pips for confirmed breakouts.
3. Configure risk management and filters
Set the stop loss to 1.5x ATR(14), take profit to 2:1 risk-reward, and position sizing to 1% risk per trade. Enable “Cancel Opposite” to remove the unfilled pending order when one side triggers. Optionally set minimum range size (15 pips) to avoid trading on days with unusually tight ranges.
4. Export, backtest, and optimize
Click Export to generate a .mq5 file. Load it into MetaTrader 5 and backtest on GBPUSD H1 with at least 2 years of historical data. Optimize the range timing (try 22:00-06:00 and 23:00-07:00 as alternatives), buffer size (1-5 pips), and minimum range size. Demo trade for 1-3 months before going live.
Optimization Tips
Match range timing to your broker's server time
The Asian session timing depends on your broker's server timezone. Some brokers use GMT, others GMT+2 or GMT+3. Verify the correct offset so your range actually captures the low-volatility Asian hours. An incorrect time offset can completely invalidate the strategy.
Set a minimum range size filter
Very tight ranges (under 10-15 pips) produce unreliable breakouts because a small range can be broken by normal noise. Setting a minimum range of 15-20 pips ensures you only trade when there was meaningful consolidation. Similarly, avoid very wide ranges (over 60-80 pips) where the stop loss becomes too large.
Beware of curve-fitting the time window
If your optimizer finds that a range of 01:17-07:43 is the best window, you have overfitted. Stick to round hour boundaries that correspond to real market sessions. The Asian session (00:00-08:00 GMT) works because of a real structural reason — not because of a statistical artifact in your backtest data.