Skip to main content

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

BUY SIGNAL: Price closes above the range high + 2 pip buffer after the Asian session ends
SELL SIGNAL: Price closes below the range low - 2 pip buffer after the Asian session ends
EXIT: Stop loss at 1.5x ATR(14) or take profit at 2:1 risk-reward ratio. Cancel opposite pending order on fill.

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.

ParameterValueType
Range TypeCustom Time (Asian)Session
Range Start00:00 GMTTiming
Range End08:00 GMTTiming
Breakout Buffer2 pipsFilter
Stop Loss1.5x ATR(14)ATR-based
Take Profit2:1 R:RRisk-reward
Cancel OppositeYesOrder management
Position Sizing1% risk per tradeRisk

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.

Frequently Asked Questions

What is the best session range for breakout trading?
The Asian session (00:00-08:00 GMT) range traded at the London open is the most popular and well-tested approach. The Asian session typically produces a tight consolidation range, and the London open brings the volume and volatility needed to break out of it. Alternatively, you can use the first 4 H1 candles of any session as your range.
Should I trade breakouts in both directions or only one?
Trading both directions (buy above range high, sell below range low) is the standard approach. However, adding a trend filter (200 EMA on H4) to only trade breakouts in the trend direction can significantly improve results. In strong uptrends, only trade upside breakouts; in downtrends, only trade downside breakouts.
What is the buffer/offset and why is it important?
The buffer adds a small number of pips (typically 2-5) above the range high or below the range low before triggering the breakout entry. This filters out false breakouts where price barely touches the range boundary before reversing. Without a buffer, you get more trades but many more false signals.
Which currency pairs work best for range breakout strategies?
GBPUSD, EURUSD, and USDJPY are ideal because they have tight spreads and respond strongly to the London and New York session opens. GBPUSD is especially popular for Asian range breakouts because of the strong GBP volatility during London hours. Avoid exotic pairs with wide spreads that eat into breakout profits.
How do I avoid false breakouts?
Three proven filters: (1) Add a breakout buffer of 2-5 pips above the range boundary. (2) Require the breakout candle to close beyond the range (candle close mode), not just wick through it. (3) Set a minimum range size (e.g., 15-20 pips) — if the range is too tight, breakouts are unreliable. Volume confirmation can also help but is less reliable in forex.

Build the Range Breakout EA in minutes

Create this strategy with AlgoStudio's visual builder. Free plan available — no credit card required.

Start Validating — Free

Risk Warning: Trading in financial markets involves substantial risk of loss and is not suitable for every investor. Past performance does not guarantee future results. Always test strategies on a demo account first. AlgoStudio is a strategy validation platform — it does not provide financial advice or guarantee profits. See our Terms of Service for full details.