Breakout Signal Indicator: Testing Against The Stored Edge

Written by Dominic Walsh · Published · Last updated

The breakout signal indicator builds a twenty-bar channel and then does one careful thing with it. The break test reads the edge value stored on the previous bar rather than recomputing it. A channel edge moves as bars age out, and that detail decides whether a break registers.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from GBPUSD M15.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 4: Breakout High, Breakout Low, Buy Signal, Sell Signal
Alerts popup, push notification, email, sound
Inputs 8

What the Breakout Signal Indicator draws on the chart

Breakout High is the indian red line at the highest high of the window.

Breakout Low is the tomato line at the lowest low.

Buy Signal marks a close above the stored high edge.

Sell Signal marks a close below the stored low edge.

  • Breakout High: line, indian red, width 2
  • Breakout Low: line, tomato, width 2
  • Buy Signal: arrow, lime, width 2, arrow code 233
  • Sell Signal: arrow, red, width 2, arrow code 234
Breakout signal indicator on GBPUSD M15 with the stored channel edges and break marks
Breakout signal indicator on GBPUSD M15 with the stored channel edges and break marks

How the Breakout Signal Indicator calculates its values

Building the channel

hh and ll start from the previous bar high and low, then scan `LookbackBars` `20` bars back. The current bar never joins its own channel. Both values go into the plotted buffers.

Reading the stored edge

prev_hh takes HighBuf at index plus one, which is the edge as it stood on the previous bar. The test then compares the current close against that value. Recomputing instead would let the level shift under the comparison.

Requiring a change

A buy needs the current close above prev_hh and the previous close at or below it. Both closes get tested against the same stored level, so a bar already outside the channel raises nothing.

How to read the signals

A mark means the close crossed a level that existed before the bar opened.

Both edges hold flat until a new extreme enters the window.

In a range price crosses both edges within a handful of bars.

Lengthen `LookbackBars` for a wider channel and rarer breaks.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

`EnableAlerts` arrives switched on, and `EnablePopup` does the talking. `EnablePushNotify`, `EnableEmail` and `EnableSound` all begin false. `SoundFile` picks the clip. The break test reads two completed closes, one message per bar.

Every Breakout Signal Indicator input

Core settings

Setting What it does Default
LookbackBars Donchian lookback (bars). How many completed bars the channel spans, default `20`. 20

Display settings

Setting What it does Default
ArrowOffsetPoints Arrow offset from price (points). Mark distance from price in points, default `12.0`. 12.0

Alert settings

Setting What it does Default
EnableAlerts Master switch for the range break alerts, default `true`. on
EnablePopup Terminal dialog on a range break, default `true`. on
EnablePushNotify Phone push on a range break, default `false`. off
EnableEmail Mail delivery on a range break, default `false`. off
EnableSound Sound playback on a range break, default `false`. off
SoundFile Wav clip for the break alert, default `alert.wav`. alert.wav
Breakout signal indicator inputs: LookbackBars and ArrowOffsetPoints
Breakout signal indicator inputs: LookbackBars and ArrowOffsetPoints

Settings that fit your chart

GBPUSD M15 is the reference chart, and it produces clean channel breaks around the London hours. Twenty bars there covers five hours. On M5 the channel is narrow and breaks come often. On H1 and above a twenty-bar extreme is a genuine event.

When the Breakout Signal Indicator fails

A break of a twenty-bar extreme says nothing about whether the move continues.

The channel widens after a large bar, which delays the next qualifying break.

Reading the stored edge is more correct, and it still cannot make a false break true.

Copy the compiled Breakout Signal 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.

Download the Breakout Signal Indicator for MT4 and MT5

The zip holds the compiled Breakout Signal 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.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

Why does the Breakout High buffer get reread?

Because the channel edge changes as bars leave the window. Comparing the previous close against a freshly computed level would mix two different reference prices. Using HighBuf from the previous bar keeps both closes measured against one level.

How much trade does LookbackBars at 20 hold?

Twenty completed bars of range. On GBPUSD M15 that is five hours, which spans the London open nicely. Lengthen it for rarer breaks describing a wider stretch, or shorten it for a much busier chart.

Why does the Breakout High line hold flat?

Because a channel edge keeps its value until a new extreme enters the window or the defining bar ages out. That gives a staircase rather than a slope. It is a property of the calculation, not a drawing fault.

Is ArrowOffsetPoints at 12.0 enough?

Just over a pip on a five-digit feed, which sits tight against the candle. On GBPUSD M15 that works. On an instrument with much larger bars the mark will look cramped, so raise it there.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Breakout Signal Indicator as one input. Always backtest before trading live.

Category: this is part of our Signal and Forecast collection. Thus, hence, yet, truly, browse more Signal and Forecast for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment