Assembly Non Repaint Indicator: A 20-Bar Donchian Breakout

Written by Dominic Walsh · Published · Last updated

Underneath the name this is a clean Donchian breakout tool. The assembly non repaint indicator plots the highest high and lowest low of the last twenty bars as a channel, then marks any bar that closes outside it. The channel comes from bars that have already closed, which is why a printed arrow stays where it printed.

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: Upper Channel, Lower Channel, Buy, Sell
Alerts popup, push notification, email, sound
Inputs 8

What the Assembly Non Repaint Indicator draws on the chart

Upper Channel traces the highest high of the lookback window in medium sea green.

Lower Channel traces the lowest low in maroon.

Buy places a wide lime arrow below a bar closing above the upper boundary.

Sell places a wide red arrow above a bar closing below the lower one.

  • Upper Channel: line, medium sea green, width 1
  • Lower Channel: line, maroon, width 1
  • Buy: arrow, lime, width 4, arrow code 233
  • Sell: arrow, red, width 4, arrow code 234
Assembly non repaint indicator on EURUSD H1 with the 20-bar channel and breakout arrows
Assembly non repaint indicator on EURUSD H1 with the 20-bar channel and breakout arrows

How the Assembly Non Repaint Indicator calculates its values

Building the channel from settled bars

iHighest and iLowest run over `ChannelPeriod` bars starting at i+1, not at i. That offset matters more than it looks. Starting one bar back keeps the current bar out of the boundary it must beat, so the channel describes history rather than the present.

Writing the boundaries

UpBuf[i] takes high[hh] and LoBuf[i] takes low[ll], where hh and ll are the bar indices those functions returned. Both lines therefore sit at real prices from real bars rather than at an average. The recalculation range stops at rates_total minus `ChannelPeriod` minus 2, keeping the loop clear of bars the window cannot cover.

Marking the breakout

The test is deliberately plain: close[i] above UpBuf[i] writes a buy arrow at low[i] minus the offset, and close[i] below LoBuf[i] writes a sell above the high. Since the boundary was built from older bars, a close beyond it means price has genuinely exceeded its recent range rather than simply touching its own extreme.

How to read the signals

A widening channel means the last twenty bars covered more ground, so breakouts become harder to achieve.

A flat boundary marks a level the market has failed to beat for the whole lookback.

Arrows cluster at the start of a move and go quiet once the channel has caught up with price.

Because the boundary excludes the current bar, an arrow can print while price sits well inside the newly drawn channel.

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

Four channels sit under `EnableAlerts`: popup, push notification, email and sound. Popup starts on, the others start off, and `SoundFile` names the clip. The guard compares against the stored bar time, so a single closed bar produces at most one message.

Every Assembly Non Repaint Indicator input

Core settings

Setting What it does Default
ChannelPeriod Bars in the high and low window, default `20`. Shorten it for a tighter channel and far more breakouts; lengthen it for rarer, larger ones. 20

Display settings

Setting What it does Default
ArrowOffsetPoints Gap between candle and arrow, default `35` points, set wide because the arrows draw at width 4. 35

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Assembly non repaint indicator inputs showing ChannelPeriod and ArrowOffsetPoints
Assembly non repaint indicator inputs showing ChannelPeriod and ArrowOffsetPoints

Settings that fit your chart

Channel breakouts suit instruments that trend in bursts, which covers the majors, gold and indices. EURUSD H1 is the reference chart, where twenty bars is most of a trading day. On M5 the channel refreshes so fast that arrows come thick and fast. On H4 and daily a twenty-bar range spans weeks, and each breakout marks a genuine expansion.

When the Assembly Non Repaint Indicator fails

Every breakout system suffers in ranges. Price closing just beyond a twenty-bar extreme and turning straight back is the most common outcome in quiet conditions.

There is no volatility filter, so a one point break counts the same as a hundred point one.

The channel adapts to price, which means a strong trend keeps dragging the boundary along and arrows dry up exactly while the move continues.

Copy the compiled Assembly Non Repaint 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 Assembly Non Repaint Indicator for MT4 and MT5

The zip holds the compiled Assembly Non Repaint 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 channel start at i+1 rather than the current bar?

So the bar under test never helps set the boundary it must beat. iHighest and iLowest run over `ChannelPeriod` bars from i+1 back. Include the current bar and its own high would define the upper channel, which makes a breakout above it arithmetically impossible.

Does the assembly non repaint indicator redraw its arrows?

No. Each bar’s channel draws on bars older than itself, and the code writes the arrow at that bar. Nothing later changes those values. The channel lines keep moving as new bars arrive, which is normal, but a printed arrow stays exactly where it printed.

What happens if I halve ChannelPeriod?

You get a much tighter channel and many more arrows. At `20` the boundary reflects roughly a day of H1 trading. At 10 it tracks price closely enough that ordinary swings clear it. Most of those extra signals will be noise, so lengthen rather than shorten if the chart feels busy.

Why do the Buy arrows stop during a strong trend?

Because the channel follows price. Once a move is underway the twenty-bar high keeps rising with it, so each new bar has a higher bar to beat. Breakout channels signal the START of expansions well and say little once one is in progress.

Are results guaranteed?

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

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