London Breakout EA
The range is built from every closed bar whose open time falls between InpRangeStartHour and InpRangeEndHour, in the broker's own server time (TimeHour(TimeCurrent()) - MQL4 always reports server time, never the trader's local clock). Once the window closes, the first bar to close beyond either side of that range opens a position in that direction, with the stop at the opposite range edge. Only one trade is taken per calendar day, and any open position is force-closed once InpSessionEndHour is reached, breakout or not. Session hours are a broker-specific setting, not a universal constant - server time zone and DST handling vary between brokers, so the default window (6-8 for the range, trading until 16) needs checking against your own broker's clock before relying on it, and the .txt intentionally does not claim a single correct value. Position sizing can run as a fixed lot or, with InpUseRiskSizing on, as a percentage of equity risked to the range width, using MODE_TICKVALUE and MODE_TICKSIZE rather than a hardcoded contract size so it prices correctly on gold, indices and JPY crosses as well as plain FX pairs. Notes and limitations - Exactly one trade per calendar day (server date), win, lose, or skipped - this EA does not re-arm intraday. - If the range-edge stop would land inside the broker's minimum stop distance, that day is skipped entirely rather than sending an invalid order. - Only one position at a time, tracked by InpMagicNumber. It will not manage or interfere with trades opened manually or by another EA. - The session-end flatten runs on every tick once the hour is reached, so a position is closed close to that boundary, not necessarily at the exact minute. - Requires AutoTrading enabled and trading permitted at the terminal, account and expert level; if trading is disabled the EA logs it and skips the entry.
Expert advisor · MT4 · v1.0 · Free
About London Breakout EA
London Breakout EA is an expert advisor (trading robot) for MetaTrader 4. It trades only in the hours you set (time filter), can size trades from your balance and risk percent and trades breakouts. It has 12 settings, such as Range start hour, Range end hour and Session end hour. MQL source code included.
Files in the download: LondonBreakoutEa.ex4, LondonBreakoutEa.mq4, LondonBreakoutEa.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Range start hour | 6 | Range window start, broker server hour (0-23) |
| Range end hour | 8 | Range window end, broker server hour (0-23) - breakout trades only after this hour |
| Session end hour | 16 | No new entries at or after this server hour; existing trade still managed |
| Stop loss pips | 0 | Extra stop-loss buffer beyond the range edge, in pips (0 = stop exactly at range edge) |
| Take profit pips | 0 | Take profit distance, in pips (0 = none, exit only on session end or reverse) |
| Use risk sizing | false | Size by percent risk instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Magic number | 20260608 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Breakout · Trading Sessions · Time Filter · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code