Donchian Channel Indicator Explanation
The Donchian Channel is a trend-following indicator that creates price channels based on the highest high and lowest low over a specified period. Developed by Richard Donchian, a pioneer in managed futures trading, in the 1950s and popularized through his work on trend-following systems, Donchian Channels consist of three lines: an upper band (highest high), a lower band (lowest low), and a middle line (average of the two). The indicator is particularly effective for identifying breakouts and support/resistance levels, making it a cornerstone of many trend-following trading systems, including the famous "Turtle Trading" system.
How Donchian Channel Works: Donchian Channels are calculated by identifying the highest high and lowest low over a specified lookback period (typically 20 periods). The upper band is the highest high over the period, the lower band is the lowest low over the period, and the middle band is the average of the two: Middle Band = (Upper Band + Lower Band) / 2. The channel width represents the price range over the lookback period, with wider channels indicating higher volatility and narrower channels indicating lower volatility. When price breaks above the upper band, it signals a potential uptrend breakout, and when price breaks below the lower band, it signals a potential downtrend breakout.
When to Use Donchian Channel:
- Breakout Identification: Donchian Channels are highly effective for identifying breakouts when price moves outside the channel boundaries. A breakout above the upper band signals potential uptrend continuation, while a breakout below the lower band signals potential downtrend continuation. This makes it valuable for trend-following strategies.
- Support and Resistance Levels: The upper and lower bands act as dynamic support and resistance levels. The upper band provides resistance in uptrends, while the lower band provides support in downtrends. Price bouncing off these levels can signal trend continuation or reversal.
- Volatility Assessment: The channel width indicates market volatility, with wider channels suggesting higher volatility and narrower channels suggesting lower volatility. This information can be used to adjust position sizing and risk management.
Advantages:
- Provides clear, objective breakout signals without requiring interpretation, making it easy to implement in automated trading systems. The simple calculation method ensures reliability across all trading platforms.
- Works effectively in trending markets across multiple asset classes, including stocks, forex, commodities, and cryptocurrencies. The indicator is particularly useful for medium to long-term trend following.
- Helps identify support and resistance levels dynamically, adapting to changing market conditions. The channel boundaries provide clear reference points for entry and exit decisions.
Limitations:
- Donchian Channels can produce false breakout signals in ranging or sideways markets when price oscillates around the channel boundaries, leading to whipsaws and multiple small losses. The indicator works best in clearly trending markets.
- The indicator may lag behind price movements during rapid trend changes, as it relies on historical highs and lows. This lag can result in delayed entry and exit signals, potentially missing significant portions of profitable moves.
- Donchian Channels do not provide information about trend strength or momentum, only price position relative to recent range. Traders should combine it with momentum indicators for more comprehensive analysis.
In summary, Donchian Channels are valuable trend-following indicators that provide clear breakout signals and dynamic support/resistance levels, making them ideal for traders seeking simplicity and effectiveness in trending markets. For comprehensive understanding, refer to Donchian's original work on trend-following systems, Investopedia's Donchian Channel guide (opens in a new tab), TradingView's Donchian Channel documentation (opens in a new tab), and academic research on breakout trading systems published in journals such as the Journal of Financial Markets and the Review of Financial Studies.
Practical Example: Using the Donchian Channel Indicator in a Trading Strategy
The Donchian Channel is a trend-following indicator used to identify breakouts and dynamic support/resistance levels. In a trading strategy, the Donchian Channel indicator helps traders make entry and exit decisions based on price breakouts and channel interactions.
Scenario: You're creating a breakout strategy for EUR/USD on a 4-hour chart. You want to buy when price breaks above the upper Donchian Channel (indicating uptrend breakout) and sell when price breaks below the lower Donchian Channel (indicating downtrend breakout), using the channel boundaries as stop-loss levels.
Strategy Logic:
- Calculate the Donchian Channel(20) using a 20-period lookback. The upper band represents the highest high over 20 periods, the lower band represents the lowest low over 20 periods, and the middle band is the average of the two. The channel provides clear breakout signals and dynamic support/resistance levels.
- Buy signal: When price closes above the upper Donchian Channel, indicating a potential uptrend breakout. The lower band acts as a stop-loss level.
- Sell signal: When price closes below the lower Donchian Channel, indicating a potential downtrend breakout. The upper band acts as a stop-loss level.
Backtrader Example:
import backtrader as bt
class DonchianChannelStrategy(bt.Strategy):
params = dict(
donchian_period=20
)
def __init__(self):
self.donchian = bt.ind.Donchian(period=self.p.donchian_period)
def next(self):
if not self.position:
# Buy when price breaks above upper band
if self.data.close[0] > self.donchian.lines.top[0]:
self.buy()
else:
# Sell when price breaks below lower band or use lower band as stop-loss
if self.data.close[0] < self.donchian.lines.bot[0]:
self.sell()
# Usage
cerebro = bt.Cerebro()
cerebro.addstrategy(DonchianChannelStrategy)
Expected Outcome: By using the Donchian Channel indicator, your strategy identifies breakouts and follows trends with clear entry and exit signals, while the channel boundaries provide dynamic stop-loss levels. This approach leads to better breakout identification, improved trend-following performance, and enhanced risk management by using channel boundaries as stop-losses.
๐ก Bonus Tip
Consider using Donchian Channels in combination with volume confirmation. When price breaks above the upper band with increasing volume, it suggests strong buying interest and higher probability of trend continuation. This technique, documented in the Turtle Trading system methodology, can significantly improve the reliability of Donchian Channel-based trading strategies.
Using the Donchian Channel indicator ensures your strategy identifies breakouts effectively and follows trends with clear entry and exit signals, improving trading performance based on dynamic channel analysis.
Price Channels are the same lines
"Price Channels" is the name some platforms give to this indicator: the highest high and the lowest low of the last N bars, with an optional middle line. The construction is identical, so everything on this page applies.
The one detail that differs between platforms is which bars count. A breakout rule must compare the close with the channel of the bars before it; if the current bar is part of its own channel, its close can never be above its own high and the rule never fires. The builder handles this with a bars ago setting (the catalog example is "Close crosses above Donchian(20), 1 bar ago"). When you read another platform's Price Channel, check whether it includes the current bar before you copy a rule from it.
Build a Donchian breakout EA for MT5
The channel breakout is one of the oldest automated rules: buy when price closes above the upper line, sell when it closes below the lower line. Turtle-style trend followers used 20-bar and 55-bar channels.
In the builder. Donchian channel is one of the 47 indicator types in the Strategy Builder. In Step 3 (Entry rules) add it with Length 20 and write the buy rule as Close crosses above the upper line, 1 bar ago, and the sell rule as Close crosses below the lower line. Add a Market sessions or Spread limit filter in Step 4 and an ATR-based stop in Step 5, then get the MQL5 code in Step 7.
| Setting | Starter value | Notes |
|---|---|---|
| Length | 20 | the classic value; 14 reacts sooner and adds noise |
| Bars ago | 1 | the breakout bar is not part of its own channel |
| Timeframe | H1 or D1 | H1 gives more signals, D1 cleaner trends |
In hand-written MQL5. MQL5 has no built-in Donchian function; the EA reads the rolling extremes itself with iHighest (opens in a new tab) and iLowest (opens in a new tab), on closed bars only:
// once per new bar: the channel of the 20 bars before the last closed bar
int hi = iHighest(_Symbol, PERIOD_H1, MODE_HIGH, 20, 2);
int lo = iLowest(_Symbol, PERIOD_H1, MODE_LOW, 20, 2);
double upper = iHigh(_Symbol, PERIOD_H1, hi);
double lower = iLow(_Symbol, PERIOD_H1, lo);
double close1 = iClose(_Symbol, PERIOD_H1, 1);
bool buy = close1 > upper;
bool sell = close1 < lower;
What goes wrong. Breakouts reverse quickly in sideways chop, and long flat periods between signals are normal. Waiting for a second close outside the channel, or requiring a minimum channel width, removes many false breaks; gold and indices need a realistic spread in the Strategy Tester. Before you trust an EA, draw the 20-bar channel on the chart you trade and check that its first signals land on the same bars. A Bollinger band moves with volatility, a Donchian channel only when a new high or low prints; the Bollinger breakout EA is the comparison worth running.
Channel breakout 20/10: history and rules
Who and when: Richard Dennis and William Eckhardt taught these rules to their trainees at the end of 1983. One of the trainees, Curtis Faith, published them in 2003; his book followed in 2007.
In 1983 the commodities trader Richard Dennis and his partner William Eckhardt disagreed on whether good traders are born or made. Dennis hired a group of beginners, trained them for two weeks at the end of December 1983 and gave them accounts to trade. The trainees became known as the Turtles. One of them, Curtis Faith, published the rules in 2003 as a free document and later wrote the book Way of the Turtle (2007).
The entry is a breakout of a price channel, a tool credited to Richard Donchian: buy when the price passes the highest high of the last 20 days, sell short below the lowest low. Volatility, which they called N, sets both the position size and the stop, 2 N from the entry. A trade is closed on a 10-day breakout against it.
The rule as the source states it
N = a 20-day average of the true range. One unit is sized so that 1 N of price movement is 1 % of the account. Enter when the price passes the high or low of the preceding 20 days, during the day. A filter skips some signals depending on the previous breakout. Add a unit every ยฝ N, up to four units. Stop 2 N from the entry. Exit a long at a 10-day low and a short at a 10-day high.
Our version
Daily bars, metals. Buy when the bar's high is above the highest high of the 20 bars before it. Close the trade when the bar's low is below the lowest low of the 10 bars before it. The short side mirrors. Stop 2 ร ATR(20), which is the source's N. Size: 2 % of equity at risk, which equals the source's unit (1 N = 1 %, stop at 2 N).
How ours differs
- The signal is read at the bar's close and the order goes at the next open; the source trades the breakout inside the day.
- No added units and no skip filter.
- Only the 20/10 system; the 55/20 system is the same file with other lengths.
- The source's limits across several markets do not apply to one chart.
- Like every library file, ours also adds the builder's default stop, position size and account limits (Steps 5 and 6). You can change them in the form.
Why this page appears for "gold": gold was among the markets the trainees traded, and the file is set up for metals. No source says the rule was made for gold.
Sources: The rules document Curtis Faith published as a free file in 2003 (its site is offline) (not linked); TurtleTrader: the original rules (opens in a new tab); Open Library: Curtis Faith, Way of the Turtle (2007) (opens in a new tab); StockCharts ChartSchool: Price Channels (opens in a new tab).
Who created the Channel breakout 20/10 strategy, and what are its rules?
Richard Dennis and William Eckhardt taught these rules to their trainees at the end of 1983. One of the trainees, Curtis Faith, published them in 2003; his book followed in 2007. Daily bars, metals. Buy when the bar's high is above the highest high of the 20 bars before it. Close the trade when the bar's low is below the lowest low of the 10 bars before it. The short side mirrors. Stop 2 ร ATR(20), which is the source's N. Size: 2 % of equity at risk, which equals the source's unit (1 N = 1 %, stop at 2 N). Being well known says nothing about how a strategy will do. Test it on your own data.
Needs the Trader plan or higher. Open in the builder โ
Being well known says nothing about how a strategy will do. Test it on your own data.


