Narrow Range Breakout System
Crabel's observation was that a daily range narrower than every other day in a recent lookback marks volatility contraction, and contraction is reliably followed by expansion. The "narrow range" qualification is checked literally here - today's range must be the smallest of the last N days including itself, not an approximation built from a smoothed volatility indicator, which is the shortcut most published attempts at this system quietly take instead of the original rule. The moment a narrow range day closes, this EA arms a buy stop above its high and a sell stop below its low for the next session, each offset by a small buffer so the breakout has to actually clear the range rather than trigger on noise at the exact level. The two orders are OCO by construction: the instant either side fills or is removed, the other resting stop is cancelled automatically, so only one position from the pair can ever exist. Any pair left unfilled by the time the next day's evaluation runs is cancelled outright - Crabel's edge belongs to the session immediately following contraction, not to a stale level left resting indefinitely. The default stop loss is the opposite side of the narrow day's own range, matching the original system's logic that the range itself defines the risk; a fixed pip stop can be substituted instead. Notes and limitations Requires at least InpNarrowRangeLength + 1 daily bars of history to evaluate, so a freshly opened symbol with a short history will not qualify immediately. This is a mechanical, literal implementation of the published rule set with no discretionary filters added - Crabel's own writing discusses additional context (trend, day of week) that this EA does not apply. Anything that trades automatically carries risk; test on a demo account before live use.
Expert advisor · MT4 · v1.0 · Free
About Narrow Range Breakout System
Narrow Range Breakout System is an expert advisor (trading robot) for MetaTrader 4. It places pending buy/sell stop or limit orders and trades breakouts. It has 9 settings, such as Narrow range length, Lots and Breakout buffer pips. MQL source code included.
Files in the download: NarrowRangeBreakoutSystem.ex4, NarrowRangeBreakoutSystem.mq4, NarrowRangeBreakoutSystem.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 |
|---|---|---|
| Narrow range length | 7 | N in NR(N) - the day must be the narrowest of this many days including itself |
| Lots | 0.01 | Fixed lot size per trade |
| Breakout buffer pips | 2 | Distance beyond the NR day's high/low for the stop entry, in pips |
| Stop loss pips | 0 | Stop loss, in pips (0 = use the opposite side of the NR day's range) |
| Take profit range multiple | 1.0 | Take profit distance as a multiple of the NR day's own range (0 = none) |
| Magic number | 20261208 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance for the breakout fill, in pips |
| Max retries | 5 | Attempts per order 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 · Pending Orders · MT4 Expert Advisor · MQL4 Source Code