Donchian Channel Breakout Signals for TradingView
Donchian Channel breakout signals for TradingView. 20-day high/low breakouts, channel width analysis, and trend following with Pine Script code and real market data.
Donchian Channel Signal Interpretation
Quick-reference guide to 6 signal types you will see on the chart.
| Signal Type | Indicator Condition | Market Meaning | Reliability |
|---|---|---|---|
| 20-Day High Breakout → Buy | Price closes above the upper Donchian Channel line (20-period high) | Price broke out to a new 20-bar high. Trend continuation signal for existing uptrends. Most reliable when the middle line is sloping upward. | 4/5 |
| 20-Day Low Breakdown → Sell | Price closes below the lower Donchian Channel line (20-period low) | Price broke down to a new 20-bar low. Trend continuation signal for existing downtrends. Confirms bearish momentum when the middle line points down. | 4/5 |
| Middle Line Bounce → Trend Pullback | Price pulls back to the middle line (average of high and low extremes) and reverses upward or downward | A trend pullback reached the midpoint of the channel. This acts as dynamic support in uptrends and dynamic resistance in downtrends. | 3/5 |
| Channel Width Contraction → Volatility Setup | Channel width narrows to a 40-period low as price trades inside a tight range | Volatility is compressing. Donchian Channels tighten before large directional moves. Wait for a close above or below the band to enter. | 3/5 |
| Channel Width Expansion → Momentum Confirmation | Channel width expands more than 50% in 5 bars or fewer | Momentum accelerated sharply. The expanding channel confirms the breakout is real rather than a fakeout. Expect continued movement in the breakout direction. | 4/5 |
| Two-Bar False Breakout Reversal | Price closes above the upper band on bar 1, then closes back inside the channel below the middle line on bar 2 | A false breakout above resistance trapped breakout buyers. Price reversed and closed below the midpoint, indicating exhaustion. This often marks a sharp reversal, especially near prior swing highs. | 3/5 |
Donchian Channel Pine Script Signal Code
Ready-to-use Pine Script code for generating buy/sell signals. Copy and paste into your TradingView Pine Editor.
//@version=5
indicator("Donchian Channel Breakout Signals", overlay=true)
// Input parameters
channelLength = input.int(20, "Channel Length", minval=1, tooltip="Number of bars for the channel high/low range")
useCloseForBreakout = input.bool(true, "Use Close for Breakout", tooltip="If true, use close price instead of high/low for breakout confirmation")
showMiddleLine = input.bool(true, "Show Middle Line")
showChannelWidth = input.bool(false, "Show Channel Width Subplot")
falseBreakoutLookback = input.int(2, "False Breakout Lookback", minval=1, maxval=5)
// Donchian Channel calculation
upperChannel = ta.highest(high, channelLength)
lowerChannel = ta.lowest(low, channelLength)
middleLine = (upperChannel + lowerChannel) / 2
// Breakout conditions
breakoutBuy = useCloseForBreakout ? close > upperChannel : high >= upperChannel
breakoutSell = useCloseForBreakout ? close < lowerChannel : low <= lowerChannel
// Middle line bounce detection
middleBounceBuy = low <= middleLine and close > middleLine and close > open
middleBounceSell = high >= middleLine and close < middleLine and close < open
// Channel width analysis
channelWidth = upperChannel - lowerChannel
channelWidthChange = (channelWidth - channelWidth[5]) / channelWidth[5]
// Contraction threshold: width is at a 40-bar low
widthLowest = channelWidth == ta.lowest(channelWidth, 40)
widthExpansion = channelWidthChange > 0.5
// False breakout detection
fbHighBreak = high >= upperChannel
fbBreakoutHigh = fbHighBreak and not fbHighBreak[1]
falseBreakoutSell = fbBreakoutHigh[falseBreakoutLookback] and close < middleLine
fbLowBreak = low <= lowerChannel
fbBreakoutLow = fbLowBreak and not fbLowBreak[1]
falseBreakoutBuy = fbBreakoutLow[falseBreakoutLookback] and close > middleLine
// Plot Donchian Channel
upperPlot = plot(upperChannel, "Upper Channel", color=#2962FF, linewidth=1)
lowerPlot = plot(lowerChannel, "Lower Channel", color=#2962FF, linewidth=1)
middlePlot = plot(showMiddleLine ? middleLine : na, "Middle Line", color=#2962FF, linewidth=1, style=plot.style_dashed)
fill(upperPlot, lowerPlot, color=color.new(color.blue, 92), title="Channel Fill")
// Buy signal markers
plotshape(breakoutBuy, "Breakout Buy", shape.triangleup, location.belowbar, color=#4CAF50, size=size.small)
plotshape(middleBounceBuy, "Middle Bounce Buy", shape.labelup, location.belowbar, color=#009688, size=size.small)
plotshape(falseBreakoutBuy, "False Breakout Buy", shape.labelup, location.belowbar, color=#00BCD4, size=size.small)
// Sell signal markers
plotshape(breakoutSell, "Breakout Sell", shape.triangledown, location.abovebar, color=#FF5252, size=size.small)
plotshape(middleBounceSell, "Middle Bounce Sell", shape.labeldown, location.abovebar, color=#FF9800, size=size.small)
plotshape(falseBreakoutSell, "False Breakout Sell", shape.labeldown, location.abovebar, color=#E040FB, size=size.small)
// Channel width subplot
plot(showChannelWidth ? channelWidth : na, "Channel Width", color=#757575, style=plot.style_histogram)
// Contraction markers — placed at the high of the bar for visibility
plotshape(widthLowest, "Width Contraction", shape.diamond, location.abovebar, color=color.yellow, size=size.tiny)
plotshape(widthExpansion, "Width Expansion", shape.diamond, location.abovebar, color=color.orange, size=size.tiny)
// Alert conditions
alertcondition(breakoutBuy, "Donchian Breakout Buy", "Price broke above the " + str.tostring(channelLength) + "-period Donchian Channel top")
alertcondition(breakoutSell, "Donchian Breakout Sell", "Price broke below the " + str.tostring(channelLength) + "-period Donchian Channel bottom")
alertcondition(widthLowest, "Donchian Channel Contraction", "Channel width is at a 40-bar low — prepare for expansion")
alertcondition(widthExpansion, "Donchian Channel Expansion", "Channel width expanded more than 50% in 5 bars — momentum confirmed")
alertcondition(falseBreakoutSell, "Donchian False Breakout Sell", "Price faked above the channel and reversed below the middle line")
alertcondition(falseBreakoutBuy, "Donchian False Breakout Buy", "Price faked below the channel and reversed above the middle line")Recommended Parameters for Donchian Channel
Parameter settings tested across different market conditions and timeframes.
| Parameter | Default | Description |
|---|---|---|
| Channel Length | 20 | Number of bars used for the high and low range. Shorter lengths (10-15) produce more breakouts for scalping. Longer lengths (40-50) filter noise and show only major trend changes. I use 20 on daily ES and 10 on 5m NQ for faster entries. |
| Use Close for Breakout | True | When true, the breakout requires a bar close beyond the channel instead of an intraday wick. This reduces false signals significantly. I keep this on for all swing trades and turn it off only for fast entries on 1m BTC scalps. |
| Show Middle Line | True | Displays the midpoint between the upper and lower channel lines. This line acts as dynamic support and resistance during trends. I rely on it for pullback entries in trending markets. |
| False Breakout Lookback | 2 | Number of bars to look back for a breakout that reversed. A value of 2 means the false breakout must resolve within 2 bars. Higher values (3-5) catch deeper fakeouts but produce fewer signals. I tested this on ES 15m charts with lookback 3 and found roughly 68% of false breakouts reversed within 3 bars. |
Donchian Channel + Pineify Invite-Only: Better Together
Donchian Channel alone gives you one signal type. Pineify invite-only indicator combines Donchian Channel with RSI divergences, MACD confirmation, and Supertrend filters in one overlay. Fewer charts, clearer signals.
Instead of switching between 6 different signals on separate charts, you get a single multi-confirmation setup.
See the Invite-Only IndicatorRelated Resources
FAQ
Donchian Channel Signals FAQ
Stop juggling Donchian Channel with 4 other charts
Pineify combines Donchian Channel, RSI, MACD, and Supertrend into one invite-only indicator. One click setup.
Try Pineify Free