New: the Top 10 Non-Repainting MT4 Indicator Pack is free to download

92 free indicators for MetaTrader 4 & 5

Donchian Channel Indicator MT4

Free Donchian Channel indicator for MT4. Plots the N-bar high, low and midline with closed-candle breakout alerts. Settings, strategy and install guide. Free download, link emailed in seconds.

MT4Non-repaintingChannels & Levels
Data Windowdonchian-channel-indicator-mt4
PlatformMT4 Build 600+
File.mq4 / .ex4 in .zip
Version1.0
Size3.7 KB
RepaintsNo
TypeChannels & Levels
UpdatedNov 22, 2026
DownloadsNew listing
Download free (3.7 KB)
  • Enter your email, the download link arrives in seconds
  • Free bonus reports on the next page

Indicators are analysis tools, not trade signals. Forex trading on margin carries a high risk of loss. Test on a demo account first.

EURUSD · H4 · previewDonchian Channel Indicator MT4 v1.0
Donchian Channel Indicator MT4 on EURUSD H4Non-repainting
How it works →
Overview

The Donchian Channel indicator for MT4 draws the highest high and lowest low of the last N bars as an upper and lower band, with an optional midline between them. It shows the recent trading range at a glance and can alert you when a closed candle breaks out of that range, which makes it a classic breakout and trend-following tool.

Donchian channels were made famous by trend-following breakout systems that bought new N-bar highs and sold new N-bar lows. This free MetaTrader 4 version keeps the calculation plain and adds closed-bar breakout alerts, so you do not have to watch the chart all day.

What Is the Donchian Channel Indicator?

A Donchian channel is a price envelope built only from highs and lows. The upper band is the highest high over a lookback period, the lower band is the lowest low over the same period, and the middle line is the average of the two. There is no smoothing and no volatility formula, so the bands move in steps: the upper band only rises when price makes a new high and only falls when an old high drops out of the window.

That makes the channel easy to read. When price pushes against the upper band, it is making new highs for the period. When the channel is flat and narrow, the market is consolidating.

How it is calculated

  • Upper band = highest high of the last ChannelPeriod bars.
  • Lower band = lowest low of the same bars.
  • Midline = (upper + lower) / 2, shown when ShowMiddle is true.

With ExcludeCurrentBar set to true (the default), the bands on each bar are calculated from the N bars before it. That means a candle can close above the upper band, which is exactly what a breakout looks like. With it set to false, the current bar is included in its own window, so price touches the band but can never close outside it.

The breakout alert always uses the same rule, whichever setting you choose: when a new bar opens, the indicator checks whether the candle that just closed finished above the highest high, or below the lowest low, of the ChannelPeriod bars before it.

Key Features

  • Upper, lower and middle bands with independent colors.
  • Option to exclude the current bar so breakouts are visible on the chart.
  • Pop-up and push alerts on closed-candle breakouts only, once per bar.
  • Bands are indicator buffers, so you can read exact values in the Data Window or call them from an Expert Advisor with iCustom.
  • Lightweight calculation that only updates the newest bar on each tick.

How to Trade With the Donchian Channel Indicator

Breakout entries

  1. Wait for a candle to close above the upper band (with ExcludeCurrentBar true) for a long trade, or below the lower band for a short trade. The alert fires on exactly this event.
  2. Check the bigger picture. Breakouts in the direction of the higher-timeframe trend tend to be cleaner than breakouts against it.
  3. Enter on the next bar’s open, or wait for a pullback toward the broken band.
  4. Place the initial stop at the midline or at the opposite band for a wider, trend-following stop.

Trailing exits

Many trend followers use a shorter Donchian channel as a trailing stop. For example, enter on a 20-bar breakout and exit a long position when price closes below the 10-bar lower band. You can load the indicator twice with different periods to see both.

Filtering false breakouts

Breakout systems take many small losses in sideways markets. A trend-strength filter helps: the Advanced ADX indicator or the Choppiness Index can tell you whether the market is trending or ranging before you act on a breakout. A narrowing channel that coincides with a Bollinger squeeze often comes before a larger move.

Using the midline and channel width

The midline is a simple trend reference. In a healthy uptrend, pullbacks often hold above it; a close back below the midline after a long run is an early sign the move is losing strength. Some traders only take long breakouts while price has stayed above the midline for the last several bars, and only short breakouts while it has stayed below.

The distance between the bands is also worth watching. A wide channel means price has covered a lot of ground recently, so a stop at the opposite band will be large and position size has to shrink to match. A narrow, flat channel means a quiet market. Work out the lot size from the actual stop distance rather than a fixed lot, for example with the position size calculator.

Best Settings

  • Swing trading (H4 to D1): ChannelPeriod 20 for entries; add a second copy with 10 for trailing exits.
  • Longer-term trend following (D1): ChannelPeriod 55 gives fewer, longer-lasting signals.
  • Day trading (M15 to H1): ChannelPeriod 20 to 24, combined with session times so you are not trading breakouts in the quiet Asian hours.
  • ExcludeCurrentBar: leave it true for breakout trading. Set it false if you only want to see the range including the current bar.

Does It Repaint?

No. The Donchian Channel is non-repainting. Each bar’s bands are calculated from a fixed window of bars and never change once the bar has closed. With ExcludeCurrentBar true, even the current bar’s bands are fixed, because they only use closed candles. With it false, the current bar’s bands can move while that bar is still forming, which is normal current-bar behavior. Alerts only fire after a candle closes. Our article on what repainting is explains the difference.

How to Install

Download the free file, then in MetaTrader 4 open File > Open Data Folder > MQL4 > Indicators and copy donchian-channel-indicator-mt4.mq4 into that folder. Restart the terminal or right-click Indicators in the Navigator and choose Refresh, and the indicator compiles and appears under Indicators > Custom. Drag it onto a chart and adjust the inputs in the window that opens. The full walkthrough, with fixes for common problems, is in our guide on how to install indicators in MT4. This is an MT4 file, so it will not load in MetaTrader 5 (the two platforms use different file formats), and the MT4 mobile apps cannot run custom indicators at all, as explained in our MT4 mobile indicators guide.

Related Indicators

Explore more breakout trading indicators in the library.

Trading on margin carries a high level of risk, so test any new tool on a demo account before you use it with real money.

Donchian Channel Indicator MT4 on an EURUSD H4 MT4 chart

Donchian Channel Indicator MT4 on a MetaTrader chart. Click to enlarge.

Repaint verdict: does not repaint. We read the source: every value is calculated on closed bars and never rewritten, so what you see in history is what you would have seen live.

Free pack

Get the Top 10 Non-Repainting Indicator Pack

Ten MT4 indicators that draw on closed bars only, in one zip with install notes for each.

Settings

Inputs, defaults and what they change

  • ChannelPeriod (default 20) — Number of bars used for the highest high and lowest low.
  • ExcludeCurrentBar (default true) — When true, the channel on each bar is built from the ChannelPeriod bars before it, so a close outside the channel is visible. When false, the bar itself is included.
  • ShowMiddle (default true) — Show the midline, halfway between the upper and lower band.
  • UpperColor (default DodgerBlue) — Upper band color.
  • LowerColor (default OrangeRed) — Lower band color.
  • MiddleColor (default Gray) — Midline color (drawn dotted).
  • AlertOnBreakout (default false) — Pop-up alert when the candle that just closed finished above the highest high or below the lowest low of the ChannelPeriod bars before it.
  • PushNotification (default false) — Send the same breakout message as a push notification to the MT4 mobile app.
Install

How to install it in MetaTrader 4

  1. Step 1Download and unzip

    Enter your email, open the download link we send you and extract the .mq4 / .ex4 file from the zip.

  2. Step 2Open the data folder

    In MetaTrader, go to File → Open Data Folder.

  3. Step 3Copy into Indicators

    Place the file in MQL4 → Indicators, then restart MetaTrader or refresh the Navigator panel.

  4. Step 4Attach it to a chart

    Find it under Navigator → Indicators and drag it onto any chart.

First time installing an indicator? Watch the 75-second video or follow the screenshots in our MT4 install guide: every click in MetaTrader, plus fixes for an indicator that won't show up.

Free forex calculators
FAQ

Donchian Channel Indicator MT4 questions

It shows the highest high and lowest low over a set number of bars. Traders use it to spot breakouts to new highs or lows, to define the current range, and as a trailing stop in trend-following systems.

20 bars is the most common setting and the default here. Longer periods such as 55 give fewer, slower signals for long-term trends, while shorter periods such as 10 are often used for trailing exits. Test the period on your own market and timeframe.

That happens when the current bar is included in its own window, because the band then always contains that bar’s high and low. Set ExcludeCurrentBar to true and the channel uses only the bars before each candle, so breakouts become visible.

Bollinger Bands are a moving average plus and minus standard deviations of closing prices, so they curve smoothly. Donchian Channels use only the highest high and lowest low over the period, so they move in flat steps and mark actual price extremes.

No. Bands on closed bars never change. With ExcludeCurrentBar true, even the live bar’s bands are fixed because they use only closed candles. Breakout alerts are sent only after a candle closes.

Yes. Set PushNotification to true and add your MetaQuotes ID in MT4 under Tools > Options > Notifications. The desktop terminal or a VPS must keep running, since the mobile app cannot run custom indicators.

Donchian Channel Indicator MT4
Size
3.7 KB
Version
1.0
Repaints
No
Download free
Free packTop 10 Non-Repainting Indicators

Ten closed-bar MT4 indicators in one zip.

Get the pack

Donchian Channel Indicator MT4Free · 3.7 KB

Download

Where should we email your download link?

Use an email you can check right now: the download link goes straight to this inbox.