An overlay that plots a Donchian channel from the prior highest high and lowest low over an adjustable length, with an optional midline and fill, plus a fast and a slow EMA.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
75 lines of Pine Script v5 from indicators/donchianchannel.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Donchian Channel highlights a breakout bar when the close crosses the channel, sits on the matching side of the fast EMA, the fast EMA is on the matching side of the slow one, and RSI has just crossed 70 or 30. A tick filter can widen the breakout test. Alerts fire on confirmed bars.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Moving Average Length
int
25
fastMaLen
Moving Average Length
int
350
slowMaLen
RSI Length
int
14
rsiLen
Donchian Channel Length
int
20
dcLen
Show Midline?
bool
false
showMid
Fill Donchian Channel?
bool
false
fillDc
Breakout Filter (Ticks)
int
0
brekOutFilter
Show Breakouts?
bool
true
showBreakouts
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Sideway Zones Live is an overlay indicator that estimates inner and outer sideways bands from recent highs and lows with a rational quadratic kernel. It tracks swing pivots over a loopback period and counts bars that remain between the outer high and low. Afte
This indicator adapts Michael Chalek's Dual Thrust trading concept to plot breakout levels and overlay bands directly on the price chart. It calculates lookback ranges based on historical price action and provides two algorithmic variations along with multiple
This indicator calculates dynamic upper and lower trendlines from pivot highs and pivot lows across a specified bar length. Trendline slopes are derived using ATR, standard deviation, or linear regression methods. It plots trendlines and breakout signal labels
This indicator detects inside candles inside larger parent candles on the price chart. It plots colored boxes around inside and parent candles, fills them with user-adjustable transparency, draws Fibonacci retracement lines and mother candle range lines, and d
This indicator plots Donchian Channels alongside fast and slow simple moving averages directly on the price chart. It generates bullish breakout signals when the high reaches the upper channel while the close is above the 50 SMA (and optionally the 200 SMA). B
This indicator classifies market trends into structured stages based on moving average alignments, compression, and ATR distance from the 50-period SMA. It tracks multiple exponential moving averages against the 50 SMA to detect basing phases, breakouts, trend