Loading…

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 · MT5 · v1.0 · Free

About Narrow Range Breakout System

Narrow Range Breakout System is an expert advisor (trading robot) for MetaTrader 5. 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.ex5, NarrowRangeBreakoutSystem.mq5, NarrowRangeBreakoutSystem.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Narrow range length7N in NR(N) - the day must be the narrowest of this many days including itself
Lots0.01Fixed lot size per trade
Breakout buffer pips2Distance beyond the NR day's high/low for the stop entry, in pips
Stop loss pips0Stop loss, in pips (0 = use the opposite side of the NR day's range)
Take profit range multiple1.0Take profit distance as a multiple of the NR day's own range (0 = none)
Magic number20261208Magic number for orders opened by this EA
Slippage pips3Slippage tolerance for the breakout fill, in pips
Max retries5Attempts per order action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Breakout · Trading Sessions · Pending Orders · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria