Breakout Arrow Indicator: A 20-Bar Donchian Channel

Written by Dominic Walsh · Published · Last updated

The breakout arrow indicator is the Donchian channel with a mark on it. `LookbackBars` sets the window, and the code deliberately starts that window one bar back. Excluding the current bar is what lets a close beat its own channel rather than defining it.

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: Donchian High, Donchian Low, BUY, SELL
Alerts popup, push notification, email, sound
Inputs 8

What the Breakout Arrow Indicator draws on the chart

Donchian High is the dodger blue line at the highest high of the window.

Donchian Low is the tomato line at the lowest low.

BUY marks a close above the high line and SELL marks a close below the low line.

Marks sit `ArrowOffsetPts` `30` from the candle.

  • Donchian High: line, dodger blue, width 2
  • Donchian Low: line, tomato, width 2
  • BUY: arrow, lime, width 3, arrow code 233
  • SELL: arrow, red, width 3, arrow code 234
Breakout arrow indicator on GBPUSD M15 with the Donchian channel and break marks
Breakout arrow indicator on GBPUSD M15 with the Donchian channel and break marks

How the Breakout Arrow Indicator calculates its values

Building the channel

hh and ll start at the previous bar high and low, then scan `LookbackBars` `20` bars back from there. The current bar never enters its own channel. That one detail is what makes the breakout test possible at all.

The break test

buySignal needs the close above hh and sellSignal needs it below ll. Both compare the finished close against a channel built entirely from older bars, so the test is unambiguous.

Why the channel looks flat

A Donchian line holds its value until a new extreme enters the window or the old one ages out. So both lines run flat for long stretches and step rather than slope. That is normal and not a drawing fault.

How to read the signals

A narrowing channel means the last twenty bars covered less ground.

A mark records a twenty-bar extreme, which is a clear fact rather than an opinion.

The line steps rather than slopes, because it holds until a new extreme arrives.

Lengthen `LookbackBars` for rarer and more meaningful breaks.

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

`EnableAlerts` starts on and `EnablePopup` carries the text. `EnablePushNotify`, `EnableEmail` and `EnableSound` begin false. `SoundFile` picks the clip. The break test reads a completed close, so one message follows each closed bar.

Every Breakout Arrow Indicator input

Core settings

Setting What it does Default
LookbackBars Donchian lookback (bars, excluding current). Bars in the channel, excluding the current one, default `20`. 20

Display settings

Setting What it does Default
ArrowOffsetPts Arrow offset from bar high/low (points). Mark distance from the candle in points, default `30`. 30

Alert settings

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

Settings that fit your chart

GBPUSD M15 is the reference chart, where twenty bars covers five hours and spans the London open. On M5 the channel is narrow and breaks come often. On H4 and daily a twenty-bar extreme is a genuine event, which is how the original turtle traders used it.

When the Breakout Arrow Indicator fails

Breaking a twenty-bar extreme says nothing about whether the move continues.

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

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

Copy the compiled Breakout Arrow 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: Bollinger Bands breaks Strategy.

Download the Breakout Arrow Indicator for MT4 and MT5

The zip holds the compiled Breakout Arrow 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 LookbackBars exclude the current bar?

So the bar can break its own channel. If the current high fed the channel, the line would always sit at or above the close and a break would be impossible. Starting the scan one bar back fixes that.

What does LookbackBars at 20 represent?

Twenty completed bars of range. On GBPUSD M15 that is five hours. Twenty is the classic Donchian setting and a sensible default. Lengthen it for rarer breaks that describe a wider stretch of trade.

Why do the Donchian High and Low lines step?

Because each holds its value until a new extreme enters the window or the defining bar ages out. That gives a staircase rather than a curve. It is a property of the calculation, not a rendering problem.

Should ArrowOffsetPts change on GBPUSD M15?

Thirty points is three pips there, which sits clear of most candles. On a quieter pair it may look far away, and on gold it will vanish behind the bar. Adjust it against the typical candle size you actually see.

Are results guaranteed?

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

Category: this is part of our Signal and Forecast collection. Also, 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