Donchian Channel Explained: Lookback, Bars and Broker Feeds
A Donchian channel is drawn by a formula rather than by hand. The upper band is the highest high of the last N bars, the lower band is the lowest low of those same N bars, and the middle line sits halfway between them. Nothing is averaged and nothing is smoothed.
Two traders can still disagree about what it shows, and the disagreement rarely comes from the setting they both typed in. Three things decide it: whether the bar still forming is inside the window, whose price feed the bars were built from, and which side of the spread those prices represent.
Key takeaways
- One band is the highest high across a fixed number of bars and the other is the lowest low, so both are prices that actually traded rather than a statistical estimate.
- Whether the forming bar counts is a setting, not a convention. In MQL5 the search functions start at the current bar by default, which pins the upper band to any new high as it prints, so a breakout above it cannot be seen in real time.
- Daily highs and lows are cut at the trade server day boundary, so two brokers running different server offsets produce different channels from identical settings.
- On a bid-built chart the upper band is a bid price while a long is filled at the ask, so the level touched is not the level obtained.
- No official source defines a correct lookback length, and changing it after reading the chart is fitting the indicator to the past.
Table of contents
- What a Donchian Channel Measures
- The Lookback Window, and Whether the Current Bar Counts
- Why Two Brokers Draw Different Channels on the Same Pair
- The Band Is a Bid Price and the Fill Is Not
- Donchian Against Bollinger Bands and Keltner Channels
- Choosing a Lookback Length
- When the Channel Says Nothing
- Frequently Asked Questions
What a Donchian Channel Measures
Take the last N bars. The highest high among them is the upper band and the lowest low is the lower band. Both lines record what has already been paid, not what price is likely to do.
That gives the channel a behaviour no averaged indicator has: it is flat until an extreme changes. A band moves when a new high or low arrives, or when the old extreme reaches the far end of the window and drops out of it. Between those events the line does not move, however much price moves underneath.
A hand-drawn channel is built the other way, from two lines placed around a slope, where the anchor points are a judgement rather than a calculation. That construction is covered in our price channel trading strategy guide; everything below concerns the calculated kind.
The Lookback Window, and Whether the Current Bar Counts
The window has two ends and only one is obvious. N sets how far back the search reaches; almost no description states where it begins.
MetaQuotes documents that end precisely. In the MQL5 reference the functions that find the highest and lowest values in a series take a start parameter, described as the shift relative to the current bar, and it defaults to zero. Zero is the bar still forming. Unless the code moves it to one, the incomplete bar sits inside the window with the closed ones.
The consequence is larger than it sounds. With the forming bar included, the instant price prints a new high that high becomes the upper band, so the band and the price are the same number. Price can never close above the line, because exceeding it redraws it. A breakout above the upper band is not something you can watch happen.
Shift the start by one bar and the channel records closed bars only. The band is then fixed while the current bar trades, so price can cross it, sit above it, or fail at it. Same indicator, same N, different thing on the screen.
TradingView documents the same class of behaviour from the other direction: values calculated on an unconfirmed bar fluctuate until it closes. So before reading any signal, open the indicator inputs and find out which version you have. Most tools expose it as an offset or shift field, and our guide to MetaTrader indicators covers where those inputs live.
Why Two Brokers Draw Different Channels on the Same Pair
The channel is computed from the bars in your terminal, and your broker built those bars. That one fact produces differences no setting can reconcile.
Start with the day boundary. A daily bar begins at the trade server date, and MQL5 exposes server time as its own value, separate from local time, precisely because the two differ. Brokers do not all run the same offset, so the hours one broker calls Tuesday are not the hours another calls Tuesday. Each daily high of that period differs, and a channel built from twenty of them inherits twenty small differences at once.
The offset also decides how many daily bars a week contains, since a boundary placed on one side of the weekly open produces a short extra bar and a boundary placed on the other does not. We cover that in detail under broker server time.
Then there is the feed itself. A bar high is the best price that reached that server, from that broker set of liquidity providers. A thin feed and a deep one do not record the same extreme on the same minute.
So a channel backtested on one feed and traded on another are two different experiments, and the second has no results.
The Band Is a Bid Price and the Fill Is Not
MQL5 defines a per-symbol property governing which price the bars are generated from, with two documented values: bars based on bid prices, and bars based on last prices. Which applies is set by the broker, symbol by symbol.
For a symbol built from bid prices, every high and low on the chart is a bid, and so is the channel, because the channel is made of nothing but those highs and lows. A long is opened at the ask. When price reaches the upper band, the number you can buy at sits above the line by the current spread, and the band was never reachable as a purchase price.
The lower band behaves differently, and the asymmetry is the point. A short is opened at the bid, the price the chart is already drawn from, so there the level and the fill agree. One channel, two sides, two relationships to what the trade costs.
Spreads vary by broker, symbol and moment, and no official source states a figure that applies to your account. Read yours from your own platform, and check which chart mode your symbol uses.
Donchian Against Bollinger Bands and Keltner Channels
All three draw a band above and below price, and that is where the resemblance stops. They take different inputs and move for different reasons.
| Channel | What the band is computed from | What makes it move | What it cannot show |
|---|---|---|---|
| Donchian | The highest high and lowest low of N bars | A new extreme arriving, or an old one leaving the window | Anything happening between the two extremes |
| Bollinger Bands | A moving average, offset by a multiple of the standard deviation of price | Every new close, since the average and the dispersion both update | Which prices were actually traded at the edges |
| Keltner Channel | A moving average, offset by a multiple of average true range | Every new bar, through the change in average range | Where the extreme of the period sits |
Only the Donchian bands are prices that traded. The other two are levels derived from a centre line, so a touch of either is a statement about dispersion rather than about a high or a low. It also means Donchian bands cannot narrow gradually the way a deviation band does. They jump. For the smoothing behaviour you want an averaged tool, and our explanation of the moving average indicator is the place to start.
Choosing a Lookback Length
No exchange, regulator or platform vendor publishes a correct value for N, so any page offering one is offering an opinion. What can be stated is what the number does.
A longer window keeps older extremes in scope, so the bands sit further apart, update less often, and price spends most of its time inside them. A shorter window discards those extremes quickly, so the bands track recent trade and price reaches them far more often. Neither is better; they answer questions of different sizes.
One rule follows from the mechanism: the window has to be at least as long as the move you intend to trade. If it is shorter, that move redraws the band while it happens, and the level you meant to trade against no longer exists by the time you reach it.
Set the length before you look at the chart. Choosing it afterwards, by seeing which value would have caught the last few swings, fits the indicator to a period that has finished. Test it on your own feed rather than a published example, and our notes on how to avoid false breakouts deal with what to do at the moment of contact.
The best known worked example of two fixed lengths used together is the turtle trading rules, which pair a 20-day window with a 55-day one and give each a different job.
When the Channel Says Nothing
In a range the bands go flat and stay flat until a new extreme arrives. Every touch of the upper line in that state is a touch of an old high, sometimes one set weeks earlier. The line is still accurate and no longer tells you anything current.
Nor can it distinguish a break carried by real participation from one that happened because nobody was quoting. It holds no volume, no order flow and no calendar, and the bands do not know a central bank is speaking in ten minutes.
What it gives is an exact answer to one narrow question: the highest and lowest prices traded over a defined window, on a defined feed. That is a measurement of the past, and it makes no claim about what comes next.
Frequently Asked Questions
What does a Donchian channel actually measure?
It measures the highest high and the lowest low over a fixed number of past bars. Both bands are prices that were traded during that window, so the channel is a record of realised extremes rather than an average, a forecast or a volatility estimate.
Does the current candle count toward the channel?
It depends on one setting. The MQL5 search functions begin at the current bar by default, so the forming candle is included unless the start is shifted by one bar. When it is included, a new high becomes the upper band immediately and price cannot close above the line. When it is excluded, the band is fixed while the candle trades and price can cross it.
How is a Donchian channel different from Bollinger Bands?
Bollinger Bands are built from a moving average offset by a multiple of standard deviation, so they move on every close and describe dispersion. A Donchian channel is built from the extremes themselves, so it moves only when an extreme changes and it describes prices that actually traded.
Why do two brokers draw different Donchian channels on the same pair?
Because the bars differ. Daily bars are cut at the trade server date, and brokers do not all run the same server offset, so the daily highs and lows going into the calculation are taken from different periods. The feeds themselves also record different extremes.
What lookback length should a trader use?
No official source defines one. The window should be at least as long as the move being traded, otherwise that move redraws the band while it is happening. Choose the value before reading the chart, and test it on the same feed you intend to trade.
Sources checked 12 August 2026. MetaQuotes MQL5 Reference, iHighest and iLowest, Timeseries and Indicators Access · MetaQuotes MQL5 Reference, SYMBOL_CHART_MODE and ENUM_SYMBOL_CHART_MODE, Symbol Properties · MetaQuotes MQL5 Reference, TimeCurrent, Date and Time · TradingView Pine Script v6 documentation, Repainting.
Disclaimer: This page is educational information about how an indicator is calculated. It is not investment advice, not a recommendation to trade any instrument, and not a signal service. Trading leveraged products carries a high risk of losing money rapidly. Verify every setting and every cost against your own broker documentation before trading.
