Watch Range Breakout EA
- 专家
-
Sinmiloluwa Daniel Ogunmola
MQL5 developer focused on EAs that survive real brokers, not just the tester. - 版本: 1.1
- 更新: 31 十月 2026
- 激活: 5
Session range breakout EA: OCO stop orders around the early-session range, fixed risk per trade, break-even, ATR trailing stop and daily loss limit.
Many markets build a quiet range in the early hours and then break out once the main session opens. Trading that breakout by hand means waking up for it, placing two orders, cancelling the loser and managing the winner, every day.
This Expert Advisor measures the high and low of a set time window (server time, default 00:00 to 07:00) on the range timeframe. After the window closes it places a buy stop above the range and a sell stop below it, each a small ATR buffer away. When one side fills, the other order is cancelled; there is at most one trade per day. Days with a range that is too wide relative to ATR are skipped. Unfilled orders are removed at a set hour.
Risk and management:
- The stop loss sits on the other side of the range, capped at a multiple of ATR; the target is a set multiple of the stop.
- Lot size comes from a fixed percentage of the balance and the stop distance. If that lot is below the broker minimum, the minimum lot is used only when free margin covers it and it is within InpMaxLot; otherwise the order is skipped.
- The stop moves to entry plus one tick at a set multiple of the risk, then trails by ATR (only ever tightened).
- Everything is closed on Friday at a set hour. A daily loss limit closes all trades and pauses until the next day; an optional total drawdown floor stops the EA. Prop mode sets these to 4% daily and 8% total.
Before every order the EA takes a fresh price, keeps stop loss and take profit outside the broker stops level, freeze level and spread, rounds prices to the symbol tick size and checks volume limits and free margin for the exact order type. It never increases the lot after a loss and uses no grid, martingale or averaging. It does not use DLLs, web requests or external services, and it runs on any symbol and timeframe.
Recommended symbols and timeframes
- Range timeframe H1 (input InpTF); the chart timeframe does not matter.
- Liquid FX pairs such as EURUSD and GBPUSD, and XAUUSD. Adjust the range hours to your broker's server time zone.
Inputs
| Group | Input | Default | Meaning |
|---|---|---|---|
| Symbol | InpSymbol / InpTF | "" / H1 | Symbol ("" = chart symbol) / range and ATR timeframe |
| Range | InpRangeStartHr / InpRangeEndHr | 0 / 7 | Range window, server time |
| Range | InpBufferATR / InpATRPeriod | 0.1 / 14 | Entry buffer beyond the range (x ATR) / ATR period |
| Range | InpMaxRangeATR | 3.0 | Skip the day if the range is wider than this x ATR |
| Range | InpMaxSL_ATR / InpRR | 2.0 / 2.0 | Stop cap from entry (x ATR) / target = stop x this |
| Range | InpExpiryHr | 20 | Remove unfilled orders at this hour |
| Management | InpBreakEvenR / InpTrailATR | 1.0 / 1.5 | Break-even at this multiple of risk / ATR trailing distance (0 = off) |
| Management | InpFridayCloseHr | 20 | Close all on Friday at this hour (25 = off) |
| Risk | InpAutoTrade / InpRiskPct | true / 0.5 | Trading on/off / risk % per trade |
| Risk | InpMaxDailyLossPct / InpMaxTotalDDPct | 3.0 / 0 | Daily loss limit % / total drawdown floor % (0 = off) |
| Risk | InpPropMode | false | Use 4% daily and 8% total limits |
| Risk | InpMaxSpreadPts / InpMaxLot | 0 / 0 | Spread limit in points / lot cap (0 = off / broker max) |
| Risk | InpMagic / InpSlippage | 20261101 / 30 | Magic number / slippage in points |
Risk disclaimer
Trading leveraged products such as forex, gold and CFDs carries a high level of risk and may not be suitable for all investors. You can lose more than your deposit. This EA does not guarantee profit, and past or backtested results do not indicate future results. Test on a demo account with your own broker's conditions before using real money, and only trade money you can afford to lose.
