TradingView indicator comparisons

Donchian Channels vs Bollinger Bands on TradingView

Donchian Channels track the highest high and lowest low in a chosen window. Bollinger Bands place boundaries around a moving average using standard deviation. Choose Donchian when your rule asks whether price has exceeded a recent extreme; choose Bollinger when it asks how far price sits from its average relative to recent dispersion. Neither a channel touch nor a wide band defines an executable trade by itself.

See the decision guide

Compare the formulas before the signals

For this comparison, Donchian uses bar highs and lows. Bollinger uses an SMA of closes and population standard deviation: square root of the mean squared distance from that SMA. N is a bar count, not necessarily a number of days. The examples use N = 5 and a Bollinger multiplier of 2 to keep the arithmetic readable; these are illustrative settings, not recommended trading parameters.

  • The Donchian midpoint is not an average closing price. One distant wick can hold its boundary in place until that bar leaves the window.
  • TradingView exposes a Bollinger basis MA type, source, length, and deviation multiplier. Record those settings. Changing the source from close changes what the band measures.
CalculationDonchian ChannelsBollinger Bands
Upper boundaryMaximum high in N barsMean close + multiplier × standard deviation
Lower boundaryMinimum low in N barsMean close − multiplier × standard deviation
Middle line(Upper + lower) / 2, a range midpointSMA of the N closes in this comparison
WidthHighest high − lowest low2 × multiplier × standard deviation
Information usedThe two extremes determine the current channel.Every close contributes to the mean and dispersion.

An old extreme expires without a new price move

Use six hypothetical bars in chronological order. Every open and close is 100, and every low is 99. Bar 1 has a high of 110; bars 2 through 6 each have a high of 101. Evaluate a five-bar window including the bar being measured. All figures are price units.

  • The Donchian upper boundary drops by 9 because bar 1 expires. No new low or falling close is required. Interpreting that drop alone as fresh selling pressure would confuse window maintenance with price movement.
  • All five closes equal 100 in either window, so the close standard deviation is zero and the Bollinger lines coincide. The market still traded across intrabar ranges. Zero close dispersion does not mean zero trading risk.
  • If several bars share the maximum high, the upper channel stays there until the last occurrence leaves or a larger high enters. A non-extreme bar expiring need not change either Donchian boundary.
WindowDonchian upper / lowerDonchian middle / widthBollinger lower / middle / upper
Bars 1 through 5110 / 99104.5 / 11100 / 100 / 100
Bars 2 through 6101 / 99100 / 2100 / 100 / 100

Bollinger expansion without a Donchian breakout

In a separate hypothetical sequence, every bar has high 105 and low 95. The first five closes are 99, 100, 100, 100, 101. Add a sixth close of 104 and drop the oldest close of 99. Donchian stays at 105 and 95 throughout, with width 10. The table rounds only the displayed Bollinger results to four decimals.

  • The first squared deviations sum to 2, so SD = sqrt(2 / 5). The second sum is 12, so SD = sqrt(12 / 5). With multiplier 2, full band width is 4 × SD. The increase follows from the changed close distribution even though neither range extreme moves.
  • The new close of 104 is above the previous Bollinger upper band of 101.2649 but below the newly calculated upper band of 104.0984. Comparing against the prior band and comparing against the current band are different rules.
  • Neither expansion nor contraction states the direction of the next move. A close-based dispersion measure can also rise during a steady trend; it is not the same quantity as volatility of returns.
Five closesSMAPopulation SDBollinger lower / upperBollinger width
99, 100, 100, 100, 1011000.632598.7351 / 101.26492.5298
100, 100, 100, 101, 1041011.549297.9016 / 104.09846.1968

A touch, a close beyond a boundary, and a fill are different events

For a Donchian breakout test, define the reference as the highest high of the previous N completed bars, excluding the signal bar. On valid ordinary OHLC bars, the close cannot be greater than a channel maximum that already includes that same bar: close is no greater than high. A strict close-above-current-Donchian-upper rule therefore cannot trigger. Comparing to the prior completed window avoids that contradiction.

  • John Bollinger explicitly separates band touches from trade signals. Price can remain near an outer band during a trend. A fade rule and a continuation rule require different entry and exit conditions.
  • Specify whether equality counts, whether the rule fires once on a cross or on every qualifying bar, and whether existing positions block new entries. A signal without these details can produce different trade counts across implementations.
  • TradingView strategies simulate orders. With default bar-close calculation and next-tick market fills, an order created at a close normally fills at the next bar open. An opening gap can make that price differ from the signal level; commission and slippage also matter.
Hypothetical eventWhat it establishesWhat remains undecided
Prior upper boundary 105; new high 106, close 104Price exceeded the prior high intrabar, but the close did not.A close-confirmed entry rejects this bar; a pre-existing stop-entry order might already have filled.
Separate case: prior upper 105; new high 107, close 106; next close 104The completed close passed the breakout condition, then price returned below 105.Confirmation did not prevent a false breakout. The specified exit determines when to leave.
Price touches an upper Bollinger bandPrice reached a relative high under the chosen settings.It does not by itself prescribe selling, buying, or a fill price.

Set up a controlled comparison on TradingView

Add Donchian Channels and Bollinger Bands to the same standard candlestick chart. Start with equal lengths, Bollinger source Close and basis SMA, and display offsets of zero. Match symbol, session, adjustment settings, and indicator timeframe. Equal lengths isolate part of the calculation difference; they do not make a range boundary and a statistical band equivalent thresholds.

  • Inspect completed candles first. On the open candle, the high, low, and close can change, so channel values and signal conditions can change too. A closed chart candle does not confirm data from a still-open higher timeframe.
  • For a matched breakout experiment, use the prior completed upper boundary for both versions, enter only while flat after a close strictly above it, and define the same exit, sizing, and costs. Record signal times separately from simulated fills. This is a proposed test protocol, not a backtest result.
  • Review the first differing signal, including which bar entered or left each window. Then compare trade count, drawdown, exposure, and results after costs on the same dates. Keep later data separate from parameter selection.
  • Wait for a complete valid window in a custom calculation. Do not silently replace missing prices with zero. If a normalized band-position calculation divides by width, report it as unavailable when width is zero.

Choose the rule you need to implement

Donchian directly answers whether price exceeds a recent high or low. Bollinger describes distance from a mean relative to close dispersion under the settings used here. A rule can combine both, but they still derive from the same price history; agreement is not proof of independent confirmation or better returns. Choose the definition that matches the question, then evaluate the complete strategy.

  • Give the Pine Script AI Coding Agent your chosen length, source, basis, deviation convention, reference window, and entry/exit timing. It can draft or edit the indicator or strategy code; request a syntax check and inspect its output against the arithmetic above.
  • Specify rules you own or can inspect. This workflow does not promise access to protected scripts, account migration, or live trade execution. Syntax validation cannot establish the correctness of a trading idea or its profitability.
Where Pineify fits

Pine Script AI Coding Agent

Turn your selected channel definition and explicit trading rules into a Pine Script draft. Request syntax validation, then check the calculations and simulated behavior in TradingView.

Draft a channel comparison

Frequently asked questions

Educational comparison, not investment advice. Numerical examples use hypothetical prices and are not backtests or evidence of returns. Channel signals, generated code, and historical simulations require independent review. Neither indicator guarantees profitable trades or limits losses.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.