Simulated

Strategies · Expert Advisors

How a range breakout EA works, and what the numbers look like

Range breakout is one of the oldest automated strategies, and one of the easiest to understand. Here is exactly how it works, what decides whether it makes money, and real backtest figures, losing years included.

Markets do not move at the same pace all day. Gold, for example, is usually quiet during the Asian morning and much more active once Europe and then New York open. A range breakout system is built around that rhythm: measure the quiet period, then trade the moment price escapes from it.

It is simple enough to write on a napkin, which is exactly why it suits automation. An Expert Advisor never misses the window, never hesitates at the break, and never forgets to close the trade at the end of the day.

The four steps of a range breakout EA

1. Measure the box

Each day the EA records the highest and lowest price inside a fixed time window, for example three hours of the early session. Those two prices are the top and bottom of the "box". On the chart it looks like a rectangle drawn around a sideways stretch of candles.

2. Place stop orders on both sides

When the window closes, the EA places a Buy Stop at the top of the box and a Sell Stop at the bottom. It does not guess the direction. Price decides: whichever edge is crossed first triggers its order.

3. Trade the first break, cancel the other side

As soon as one order fills, the opposite order is cancelled, so the system holds at most one trade idea per day. Every position gets a hard stop loss the moment it opens, and the lot size is calculated from a fixed risk percentage (see how to calculate lot size for gold).

4. Finish flat

At a set time later in the day, all pending orders are deleted and any open position is closed, whatever its result. Nothing is held overnight, so there is no swap and no weekend gap risk.

Why breakouts can work, and why they often fail

A breakout works when the move out of the box keeps going. That happens when new participants arrive, for example a session open or a data release, and push price in one direction for hours.

It fails on a false breakout: price pokes through the edge, fills the order, then turns back into the box and hits the stop. On some days both sides would be hit one after the other. False breakouts are not a bug; they are the normal cost of the strategy. The system lives on the difference between a fairly large number of small losses and a smaller number of big wins.

What the numbers look like

Here are the default-settings backtests of two Exodus FX breakout robots, from January 2020 to the end of September 2026, on Fusion Markets price history, starting with $10,000. Full reports are on the results page.

Golden Box Breakout (gold)BTC Box Breakout (Bitcoin)
Net result+59.3%+116.4%
Profit factor1.261.15
Max equity drawdown8.1%27.9%
Trades1,7261,737
Winning trades51.6%37.3%
Average win / average loss$32.35 / $27.30$140.00 / $72.62
Longest losing streak11 trades15 trades

Three things stand out, and they apply to almost every breakout system:

  • The edge is thin. A profit factor of 1.15 to 1.26 means that for every $1.00 lost, the system made $1.15 to $1.26. That is a real but modest edge, and higher trading costs can erase it.
  • Losing streaks are normal. On Bitcoin only about 37% of trades won; the average win was roughly twice the average loss. Fifteen losses in a row happened in the test. If that would make you switch the robot off, the strategy is not for you, or the risk per trade is too high.
  • There are losing years. The gold version lost 4.4% in 2023. A breakout system needs volatility; in a quiet, choppy year it gives some of its profit back.

What decides your results

  1. Spread and commission. With an edge this thin, costs matter more than anything else. The same EA can be profitable on a raw-spread account and lose on a wide-spread one.
  2. Server time. The box is defined in your broker's server time. If your server runs on a different clock from the one the EA was tested on, the window has to be shifted, or you are measuring a different part of the day.
  3. The window itself. A box that is too short catches noise; one that is too long leaves little of the day to trade the break.
  4. Stop distance. Too tight and normal noise stops you out; too wide and each loss eats several wins. Tying the stop to a percentage of price keeps it sensible as the market's price level changes.
  5. Discipline. Switching the EA off after five losses and back on after the big move is the most common way to turn a positive backtest into a negative account.

How to test one yourself

Every robot on the MQL5 Market has a free demo version you can run in the MetaTrader 5 Strategy Tester. Before you buy any breakout EA, ours included:

  1. Test it on your own broker's data, with "Every tick based on real ticks" or at least 1-minute OHLC.
  2. Test several years, not three months. You want to see a losing stretch and how deep it went.
  3. Check the longest losing streak and the maximum drawdown, and ask whether you could sit through them with real money.
  4. Run it on a demo account for a few weeks to confirm that orders, times and lot sizes behave as expected on your server.

The short version

A range breakout EA measures a quiet window, places orders on both sides, trades whichever side breaks first with a hard stop, and goes flat by the end of the day. It is transparent and easy to check, but it is not magic: expect many small losses, long flat periods and the occasional losing year, and keep the risk per trade small enough to survive them.

If you want to see a full implementation, Golden Box Breakout (gold) and BTC Box Breakout (Bitcoin) publish every setting and the complete backtest.

Questions

Frequently asked

What is a range breakout strategy?

It marks the highest and lowest price of a fixed time window, then buys if price breaks above that range or sells if it breaks below. The idea is that a break out of a quiet period often starts a directional move.

Is a range breakout EA profitable?

It can be on some markets and settings, but not always. Breakout systems win a share of trades that pay for many small losses, and they have losing years. The Exodus FX gold version made +59.3% from 2020 to September 2026 in a backtest, but lost money in 2023. Simulated results are not a promise of future returns.

What is the best time window for a gold breakout?

There is no universal answer, because it depends on your broker's server time. Many gold breakout systems measure the quiet Asian hours and trade the break into the European session. Always test the window on your own broker's data.

Do I need a VPS for a breakout EA?

It is strongly recommended. The EA has to be running when the box forms and at the daily close time. If your computer is off at those moments, the day is missed or a position stays open longer than planned.

Trading foreign exchange, metals and cryptocurrencies on margin carries a high level of risk and may not be suitable for everyone. Backtested and hypothetical results are not a guarantee of future performance.

Free guide · 24 pages

New to trading robots? Start with Automated Trading Mastery

A free, plain-language introduction to algorithmic trading: what a trading robot actually is, how it makes decisions, and the steps from nothing to your first Expert Advisor running on a demo account.

Get the free guide

Rules you can read, backtests you can check

Every Exodus FX Expert Advisor publishes its full strategy, its settings and the complete backtest, losing periods included.