Advanced Range Breakout.
You pick the range. It handles the break.
A box around a session, or around the last unbroken swing highs and lows. The EA places a buy stop above and a sell stop below, keeps the planned risk when the fill slips, closes by stop, target or time, and can guard a prop firm account. No martingale, no grid.
Install and first run
One chart, one symbol. The EA trades only the symbol of the chart it is on.
- 1Get it from the MQL5 Market (MT5 or MT4 listing below). After the purchase it shows up in MetaTrader under Navigator > Expert Advisors > Market.
- 2Open a chart of the symbol you want to trade. In daily range mode the chart timeframe does not change the levels: the EA builds the range from 1-minute candles. In swing mode the chart timeframe is the timeframe of the swings (or set Swing timeframe).
- 3Drag the EA onto the chart and allow Algo Trading. Go through the inputs with steps 02 to 04 before you press OK.
- 4Check the panel. The TODAY block shows the range window in market time and in your broker's server time. If the two look right, the hours are right.
- 5Demo first. Run it on a demo account, and in the Strategy Tester with real ticks, before real money.
How it trades
Pick the levels in Breakout levels: a daily time range (the default) or swing highs and lows. Trading direction limits it to buys, sells, or both.
- ·Between Range start and Range end (market time, start included, end excluded) it records the high and the low.
- ·At the range end it places a buy stop at the high and a sell stop at the low, plus the entry buffer if you set one.
- ·Stop loss: by default at the other side of the range (100% of the range). Take profit: none by default.
- ·At Delete pending orders at the order that did not fill is deleted. At Close positions at any open position is closed.
- ·Both orders stay live after one fills, so a day can trade both directions. Set One trade a day to true to delete the other order on the first fill.
- ·If the price is already beyond a level when the range ends, that side is not placed that day. The Experts tab says so.
| Input | Factory value | What it does |
|---|---|---|
| Time zone of the hours below | London | The clock of every hour in this group. See step 03. |
| Range start / Range end | 04:00 / 10:00 | The box. HH:MM in that time zone. |
| Min / Max range size | 0 / 0 | Skips days whose range is smaller or bigger than this multiple of the daily ATR. 0 = no limit. |
| Daily ATR period | 14 | Days of the ATR above, counted to the last closed day. |
| Entry buffer | 0 | Points beyond the high and the low for the entry. |
| Delete pending orders at | 17:00 | The unfilled order is removed. |
| Close positions at | true, 17:00 | Closes what is still open. Turn it off to leave it to the SL or TP. |
| One trade a day | false | True = the first fill deletes the other order. |
| SL mode | % of the range, 100 | Or points (200 by default in that mode). |
| TP mode | No TP | Or a multiple of the SL distance (2.0 R by default in that mode), or points. |
This is the mode of the old version, with the same inputs and the same factory values. A swing high is a high with 5 lower candles on each side (Candles on each side) that has not been broken since; a swing low, the same the other way. The EA looks for them in the Last candles to scan (200). It places stop orders at those levels (or market entries), moves them to closer levels when new ones appear, and only trades inside the kill zones: London 07:00-12:00 and New York 13:00-16:00 by default, Asia off. Kill zone hours are in server time unless you change Time zone of the kill zone hours. SL and TP go in points (200 / 700), ATR %, ADR % or candles.
- Break even: moves the SL to the entry (plus a buffer in points) once the trade is at the chosen multiple of R. Off by default.
- Partial close: closes a % of the volume at a multiple of R. Off by default.
- Trailing stop: in points, ATR %, ADR % or candles, with its own trigger. Off by default.
Set the hours in market time
The question every range EA gets: "what hour do I put with my broker?" Here you put the market's hour and the EA does the conversion.
- 1In Time zone of the hours below choose the clock of the market you trade: New York, London, Frankfurt, Tokyo, UTC, or Server time if you prefer to type your broker's hours yourself.
- 2Type the range and the close hours in that clock. The EA converts them to your broker's server time every day, daylight saving changes included.
- 3Leave Server daylight saving rule on Detect automatically. It reads your broker's rule from the weekly FX open.
- 4Check TODAY in the panel: Window (local) is what you typed, Window (server) is the same window on your broker's clock.
| Factory window (London) | On Axi server time | When |
|---|---|---|
| 04:00-10:00 | 06:00-12:00 | Most of the year |
| 04:00-10:00 | 07:00-13:00 | The weeks when London and New York change their clocks on different dates: from the second to the last Sunday of March, and from the last Sunday of October to the first Sunday of November |
Axi's server clock is New York time plus 7 hours: its day starts at 17:00 New York. Your broker may differ; the panel shows the result for yours.
Risk per trade
R in this guide is what one trade loses if it hits its stop at the size the EA calculated.
| Lot size mode | Use it for |
|---|---|
| Risk % of the current balance (factory, 0.5) | Your own account. The size follows the balance. |
| Risk % of a fixed initial account size | A prop firm challenge: put the challenge size in Initial account size. |
| Fixed lot size | Testing, or if you want the same lot every day whatever the range. |
The minimum lot rule. When the calculated lot is below your broker's minimum, the EA trades the minimum lot, whatever it risks. The Experts tab line of that day says it, for example "minimum lot 0.01, risks 5.31 R". On gold, 0.01 lot with the factory window risked about $34 per trade on average in my tests: 3.4% of a $1,000 account. Whether your account is big enough is your call, and this is the number to look at.
Slippage. With Move SL and TP with the fill price on slippage on (factory), the SL and the TP move with the real fill price, so the trade keeps the risk you planned. What no EA can stop is the stop itself filling beyond its price in a fast market. On US30 at the cash open I measured stop exits of up to about 1.5 R.
Starting windows by market
Where I would start my own tests on each market. These are not tested settings and not a forecast.
| Market | Window / close at | Trades | Net | PF | Max DD |
|---|---|---|---|---|---|
| XAUUSD factory | 04:00-10:00 London 17:00 | 559 | +18.4 R | 1.11 | 12.9 R |
| USDJPY | 06:00-10:00 London 17:00 | 595 | +20.2 R | 1.10 | 21.7 R |
| GBPUSD | 04:00-07:00 London 17:00 | 826 | +50.1 R | 1.10 | 40.5 R |
| US30 | 09:30-10:00 New York 15:45 | 633 | +33.7 R | 1.15 | 20.5 R |
| DE40 | 09:00-10:00 Frankfurt 17:15 | 664 | +25.5 R | 1.11 | 25.0 R |
| EURUSD | None I would start from (best: 04:00-08:00 London) | - | +12.6 R | 1.03 | 39.8 R |
How these came out: Axi, M15 chart, 1-minute OHLC, 23 October 2024 to 23 October 2026, factory settings except the window (SL at the other side of the range, no TP, both orders, spread filter and holiday calendar on), with the risk at 0.5% of a fixed base so every trade is the same size in R. For XAUUSD and USDJPY the window was picked on 2019-2023 data; for the other four it is the best of 6 to 9 windows tested on these same two years.
- USDJPY: positive over the two years, negative over the last 12 months (-10.5 R, profit factor 0.90).
- GBPUSD: 5 of the 9 windows tested were positive. Every window that starts at 02:00 or 04:00 London and ends between 05:00 and 08:00 was positive. Every one that ends at 09:00 or later was negative.
- US30: all 6 windows tested were positive. The opening-range windows (09:30 to 10:00, 10:30 or 11:00 New York) had a profit factor of 1.15 to 1.18 and the smallest drawdowns. The windows before the open, 1.06.
- DE40: all 6 positive, profit factor 1.02 to 1.11. The best one is the first hour of Xetra.
- EURUSD: 7 of the 9 windows tested were negative. In these two years a London range breakout did not work there.
1. Most of these are the best of several windows on the same data. Outside that data the normal thing is that they do worse.
2. They were run in 1-minute OHLC, not real ticks. On indices the cash open is exactly where execution slips most: test US30 and DE40 with real ticks before using them.
3. Type the hours in the market's time with the time zone input, as in the table. The EA converts them to your broker's time.
Index symbol names change from broker to broker (on Axi they are DJ30.fs and DAX40.fs). If yours is not one of the names listed in step 06, set the holiday calendar by hand.
Spread, holidays and the weekend
A breakout EA loses most of its money in a few bad fills. These inputs are there for those days.
| Input | Factory value | What it does |
|---|---|---|
| Hold orders back while the spread is blown out | true | No new orders while the spread is at least 2x its 60-minute median. A level broken during a blowout is skipped for the day. |
| Blown out = spread at least this x the 60 min median | 2.0 | How wide counts as blown out. |
| Withdraw a pending order when the price is this x the median spread away | 3.0 | During a blowout, an order that close to the price is withdrawn, and placed again when the spread is normal. |
| Max spread | 0 | A hard cap in points. 0 = no cap. |
| Exchange holiday calendar | Auto | No orders on exchange holidays, and an earlier close on early-close days. |
| Extra days off | empty | Your own days without trading, server dates as YYYY.MM.DD;YYYY.MM.DD. |
| Close everything on Friday | false, 21:50 | Closes positions and orders on Friday at that server time. |
Auto calendar picks NYSE when the symbol name contains US30, DJ30, DJI, US500, SPX, SP500, US100, NAS100, USTEC, NDX or US2000, and Eurex when it contains DE40, GER40, DAX, DE30 or GER30. Anything else gets no calendar. If your broker uses another name, choose NYSE or Eurex yourself. Without a calendar, on a short US session the close time can come after the market has shut and the position stays open overnight: 2 nights in my US30 tests from 2021 to 2026. With it, zero.
The spread filter helps, it is not magic: in my US30 tests for 2026 it cut the entries taken during a blown-out spread from 19 to 12.
Prop firm protection
All off by default. Turn them on for a challenge or a funded account, with your firm's rules in front of you.
| Input | Factory value | What it does |
|---|---|---|
| Start of the trading day | Midnight Prague | When the daily counters reset. Or midnight server time. |
| Daily loss limit | Disabled, 4.5 | In % or in $. Closes ALL positions of the account and stops until the next day. |
| Daily loss % of | Initial balance | The prop firm rule. Or the day's opening balance, if that is how your firm measures it. |
| Daily drawdown limit | Disabled, 5.0 | % of the day's highest equity, or $. Closes ALL positions of the account. |
| Total loss limit | Disabled, 9.0 | % of the base balance, or $. Closes ALL positions and stops for good. |
| Initial balance | 0 | The base of the total loss and the daily loss %. 0 = the balance when the EA first starts. Set the challenge size if the account already moved. |
| Max trades / Max losing trades per day | 0 / 0 | Of this EA. 0 = no limit. |
- The limits act on the whole account, manual trades and other EAs included, because that is what the firm measures. Every ARB chart on the account sees the same stop.
- Risk budget: with a daily or total loss limit on, each new order is sized to what is left before the tighter limit. If not even the minimum lot fits, the order is not placed, and the Experts tab says why.
- For the lot size, use Risk % of a fixed initial account size with the challenge size (step 04).
Read the panel
The header shows the symbol, the mode (daily range or the swing timeframe) and the magic number.
- PAUSE blocks new entries. Pending orders are withdrawn and come back when you resume; a level the price goes through while paused is skipped for the day. PAUSE does not close anything.
- CLOSE ALL asks for confirmation, then deletes the pending orders and closes the positions of this EA: its magic number on this symbol. Nothing else on the account.
- Panel size: Normal (100%), Large (125%), XLarge (150%) or XXLarge (200%) for 2K and 4K screens. Show the panel = false hides it.
Coming from the old version
This is a rebuild, not a patch: new engine, MT4 and MT5 from the same code, and a new default mode.
- 1Check the inputs of every chart after the update. The input names changed, so old .set files and saved chart settings do not carry over, and a chart can come back with the new factory values: daily range mode, gold window.
- 2To keep trading the old way: set Breakout levels to Swing highs and lows. The swing inputs keep their old meaning and factory values.
- 3Two factory values changed: the trailing stop is now off (it was on), and the lot size mode is now 0.5% of the current balance (it was 2% of a fixed initial size). Set them back by hand if you want the old ones.
- 4The old daily drawdown limit is gone: Prop Firm Protection (step 07) replaces it, measured on equity with open trades included.
- 5Max spread now works. In v1.50 that input had no effect.
Questions I get asked
No. Before looking at any result I fixed four pass or fail checks for a default setting (out of sample, real ticks, stress and neighbouring windows). Neither gold nor USDJPY passed all four. So the ARB ships as a tool: you choose the market and the window, and the factory values are a template for XAUUSD. Step 05 has the starting points with their numbers and their limits.
No. One order per side of the range in daily mode, and the max buys and sells you set in swing mode (1 and 1 by default). Orders go out with their stop loss, unless you set the swing SL to 0.
The Experts tab says why. The usual reasons: an exchange holiday, the price already beyond a level when the range ended, a breakout during a blown-out spread or during a pause, a range outside the size filter, the daily trade limit, a prop firm limit, or Algo Trading switched off.
Yes, one chart per symbol and window. Give each chart its own magic number. The prop firm limits are shared: when one ARB chart hits them, all of them stop.
Daily range mode: any, the range is built from 1-minute candles (my tests ran on M15). Swing mode: the timeframe of the swings, the chart's or the one in Swing timeframe.
Use 1-minute OHLC to compare windows quickly, then confirm the one you keep with "Every tick based on real ticks". On indices, and with any trailing stop, the real ticks result is the one that counts.
Yes, on MT4 and MT5. The hours are market hours, so they carry over to any broker. Spreads, commissions and index symbol names change, and the numbers in step 05 were measured on Axi.
Where to run it
A range EA has to be on when the range ends and when it closes. That means a VPS, not your laptop.
Updates and support
- Updates arrive through the MQL5 Market in your terminal.
- Questions: support or support@doittrading.com. Send the symbol, your inputs and the Experts tab lines of the day, and I answer directly.