Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Narrow Range Expansion strategy is a pure price-action breakout system built around the classic narrow-range bar pattern (often called the NR7 setup), and it uses no technical indicators at all. Instead of moving averages or oscillators, it reads the raw High and Low of recent candles to find moments when the market is "coiling" — trading in an unusually tight range — and then waits for price to break free from that range. A narrow-range bar is simply a candle whose High-to-Low distance is the smallest of the last several completed bars, and it is widely interpreted as a sign that volatility is being compressed before a larger directional move.
The core idea behind Narrow Range Expansion is the well-documented tendency of markets to alternate between two phases: contraction (low volatility, sideways drift) and expansion (a trending burst of movement). When a market squeezes into a narrow range, buying and selling pressure reach a temporary balance. The strategy treats that balance point as stored energy. When price finally closes beyond the narrow bar's boundary, the system reads it as the start of an expansion leg and trades in that direction.
This EA is best suited to traders who want to study breakout mechanics and volatility cycles without the lag or complexity of indicators. Because every rule is derived directly from candle prices, it is an excellent learning tool for understanding how raw price action can define entries, stops, and targets. As with any system, it should be viewed as a framework for analysis and education rather than a shortcut to trading results.
How It Works
The strategy operates on a single timeframe and evaluates conditions only once per completed bar, never on every tick. Here is how the logic unfolds:
- Detecting the coil (narrow-range bar): When a bar finishes, the strategy checks whether its High-to-Low range is strictly the smallest of the last
RangeLookbackcompleted bars. If it is the narrowest, that bar becomes the "coil" and its High and Low form a breakout fence. - Arming the setup: Once a narrow-range bar is found, the strategy stores the coil's High, Low, and total range, then begins watching for a breakout. The coil range itself becomes the unit of measurement for risk.
- Waiting for confirmation: The strategy watches for up to
MaxWaitBarscompleted bars after the coil. It does not act on intrabar spikes — it waits for a bar to close beyond the fence. - Long entry signal: The strategy signals a long when a completed bar closes above the coil High plus a small buffer (the buffer equals
BreakoutBufferPctmultiplied by the coil range). This buffer helps filter out marginal breaks that barely clear the fence. - Short entry signal: Symmetrically, the strategy signals a short when a completed bar closes below the coil Low minus the same buffer.
- Stale setup handling: If no qualifying breakout close occurs within
MaxWaitBars, the coil is considered stale and abandoned. The strategy then looks for a fresh narrow-range bar. - One position at a time: The EA only opens a trade if there is no existing position for its magic number on the symbol, so it will not stack multiple positions on the same setup.
For exits, the strategy relies on a fixed stop-loss and take-profit attached at entry:
- Stop-loss logic: Risk is measured directly from the coil. The stop distance equals
StopRangeMultmultiplied by the coil range. For a long, the stop sits below the entry price; for a short, it sits above. Because the stop is tied to the size of the coil, it adapts to current volatility rather than using a fixed pip value. - Take-profit logic: The target is set as a reward-to-risk multiple of the stop distance, controlled by
RewardRiskRatio. With the default of 2.0, the take-profit is placed twice as far from entry as the stop.
This structure means each trade has a defined, pre-planned risk and reward measured in the market's own terms — the coil range — the moment the position opens.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| RangeLookback | 7 | 3 | 20 | How many completed bars the coil bar must be the narrowest of. Larger values demand a more significant volatility contraction. |
| MaxWaitBars | 3 | 1 | 10 | How many bars after the coil the strategy keeps watching for a breakout close before abandoning the setup. |
| BreakoutBufferPct | 0.10 | 0.0 | 1.0 | Breakout filter: the close must clear the fence by this fraction of the coil range. Higher values require a stronger break. |
| StopRangeMult | 1.0 | 0.5 | 3.0 | Stop distance expressed as this many coil ranges from the entry price. |
| RewardRiskRatio | 2.0 | 1.0 | 5.0 | Take-profit set as this reward-to-risk multiple of the stop distance. |
| Lots | 0.10 | 0.01 | 1.0 | Order volume in lots for each trade. |
Recommended Chart Settings
Narrow Range Expansion is a single-timeframe strategy, so it runs entirely on the chart's symbol and period you attach it to. Breakout systems like this are commonly studied on the H1 or H4 timeframes, where narrow-range bars tend to represent meaningful consolidation rather than minor noise. Liquid instruments with clear volatility cycles — major forex pairs such as EUR/USD or GBP/USD — are a sensible starting point for analysis.
Keep in mind that the ideal settings depend heavily on the instrument and prevailing conditions. A timeframe and symbol that produce clean coils in one market regime may behave very differently in another. Results will vary across different market conditions, and any configuration should be studied carefully on historical data and a demo account before drawing conclusions.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
Every strategy has strengths and weaknesses, and understanding them is part of trading education.
Strengths: Because Narrow Range Expansion uses no indicators, it is free of indicator lag and is conceptually simple to follow — you can see the coil and the breakout directly on the chart. Its risk is measured from the coil range, so stops and targets automatically scale with current volatility instead of relying on a fixed number of pips. The breakout-close requirement and buffer help filter out some weak, marginal breaks that an intrabar trigger would catch.
Known limitations: Breakout strategies are vulnerable to false breakouts, where price closes beyond the fence and then quickly reverses. This is especially common in choppy, range-bound markets where the expansion phase fails to develop. The strategy also commits to whichever direction breaks first, so a "fakeout" in one direction can lead to a losing trade even if the market later moves the opposite way. Because it trades only one setup at a time and abandons stale coils, it may sit idle for long stretches when volatility is not contracting and expanding in a clean cycle.
When it may underperform: Periods of erratic, news-driven volatility, very tight low-liquidity sessions, or persistently trendless ranges can all produce signals that historically tend to be less reliable for breakout logic. No single set of parameters performs equally well across all symbols and timeframes, so the defaults should be treated as a starting point for study, not a finished solution.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Consider these general principles as you study this EA:
- Risk a small, fixed fraction per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position, so that a string of losses does not severely damage the account.
- Size positions deliberately. The
Lotsparameter is fixed, so make sure the volume you choose matches your account size and the stop distance produced by the coil range. A wider coil means a wider stop and larger monetary risk at the same lot size. - Use a demo account first. Test the strategy on historical data and in live demo conditions before considering any real capital. This helps you understand how often signals occur and how the stop and target behave.
- Understand drawdown. Even a well-designed breakout system will experience losing streaks. Knowing the potential depth and duration of drawdown helps you set realistic expectations and avoid over-leveraging.
- Never trade money you cannot afford to lose. Leverage magnifies both gains and losses, and capital preservation is the foundation of long-term study and practice.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: NarrowRangeExpansion.ex5 (1 downloads)
- Source Code: NarrowRangeExpansion.mq5 (1 downloads)
- Documentation: NarrowRangeExpansion.pdf (1 downloads)