A range is only broken when price closes outside it. This range breakout indicator tracks the highest high and lowest low of the prior twenty bars, draws both edges, and marks the first close beyond one of them. A cooldown then stops the same side from printing again straight away.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 4: Range High, Range Low, Buy, Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 10 |
What you get on the chart
Two edge lines plus two marks on price.
`Range High` traces dodger blue.
`Range Low` traces tomato.
`Buy` prints lime at width 2 with arrow 233.
`Sell` prints red at width 2 with arrow 234.
A comment line shows both edges.
- Range High: line, dodger blue, width 1
- Range Low: line, tomato, width 1
- Buy: arrow, lime, width 2, arrow code 233
- Sell: arrow, red, width 2, arrow code 234

What feeds each plot
The range
`LookbackBars` `20` finished bars set the high and low. A bar is never part of its own range.
The break
`ConfirmationBars` `1` close must sit beyond the edge. Earlier bars must not already be outside, so only fresh breaks count.
Spacing
`CooldownBars` `5` must pass before the same side prints again.
How to watch it
Blue marks the ceiling and tomato the floor.
Edges step as old bars leave the window.
A lime mark is a fresh close above the ceiling.
A red mark is a fresh close below the floor.
`ArrowGapPoints` `12.0` sets the mark gap.
Warm-up needs about twenty-three bars.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
A fresh close beyond an edge is what reports, with the edge price in the text. `EnableAlerts` is the switch; the popup, the phone route and the speaker playing `SoundFile` ship on, while email starts off.
Every Range Breakout Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
LookbackBars |
rolling range window (bars). Bars in the rolling range, `20`. | 20 |
ConfirmationBars |
bars to confirm a break (>=1). Closes needed beyond the edge, `1`. | 1 |
CooldownBars |
bars to wait before next signal in same direction. Bars before the same side repeats, `5`. | 5 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowGapPoints |
arrow offset from candle high/low (points). Mark gap in points, `12.0`. | 12.0 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Switch for break messages, `true`. | on |
EnablePopup |
Popup, `true`. | on |
EnablePushNotify |
Phone route, ships on, `true`. | on |
EnableEmail |
Email, `false`. | off |
EnableSound |
Speaker, ships on, `true`. | on |
SoundFile |
Speaker clip, `”alert.wav”`. | alert.wav |

Where it works best
Twenty-bar ranges form constantly, so session timing matters. EURUSD H1 is the reference chart, where the edges cover about a day. On M15 they cover a session. On D1 they cover a trading month.
What to be wary of
Most range breaks fall back inside.
One close is light confirmation.
The edges lag behind fast moves.
Phone and speaker routes ship on.
Copy the compiled Range Breakout Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.
Related on forexmt4systems.com: London Session Breakout Strategy.
Download the Range Breakout Indicator for MT4 and MT5
The zip holds the compiled Range Breakout Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.
Download this indicator free
Enter your email and the file is yours. You also get the full MT4 and MT5 library.
FAQ
Does LookbackBars 20 include the breakout bar?
No. The range comes from the twenty bars before it, so a bar cannot lift its own ceiling and escape it at the same time. That keeps each break honest.
What does ConfirmationBars 1 require?
One close beyond the edge. Raise it to two or three and the close must stay outside for that many bars in a row before the mark prints, which trims false breaks.
Why can a second Buy not print right away?
Two rules stop it. The break must be fresh, so earlier bars cannot already be outside, and `CooldownBars` blocks the same side for five bars.
What do Range High and Range Low show between breaks?
The live ceiling and floor of the last twenty bars. They step down or up as old extremes leave the window, even when no break happens.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Range Breakout Indicator as one input. Always backtest before trading live.
Category: this is part of our Signal and Forecast collection. Browse more Signal and Forecast for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in Sunk cost on Wikipedia.
- Additional market context is at Introduction To Chart Patterns at StockCharts ChartSchool.
