OPEN-SOURCE SCRIPT
Closing Price Donchian Channels

//version=5
indicator("Closing Price Donchian Channels", overlay=true)
// Input parameters
length = input.int(20, "Period", minval=1)
showMid = input.bool(true, "Show Middle Line")
// Calculate upper and lower bands based on closing prices
upper = ta.highest(close, length)
lower = ta.lowest(close, length)
mid = (upper + lower) / 2
// Plot the bands
upperBand = plot(upper, "Upper Band", color=color.rgb(0, 184, 222))
lowerBand = plot(lower, "Lower Band", color=color.rgb(0, 184, 222))
midLine = plot(showMid ? mid : na, "Middle Line", color=color.rgb(209, 212, 220))
// Fill the area between bands
fill(upperBand, lowerBand, color=color.rgb(0, 184, 222, 90), title="Channel Fill")
indicator("Closing Price Donchian Channels", overlay=true)
// Input parameters
length = input.int(20, "Period", minval=1)
showMid = input.bool(true, "Show Middle Line")
// Calculate upper and lower bands based on closing prices
upper = ta.highest(close, length)
lower = ta.lowest(close, length)
mid = (upper + lower) / 2
// Plot the bands
upperBand = plot(upper, "Upper Band", color=color.rgb(0, 184, 222))
lowerBand = plot(lower, "Lower Band", color=color.rgb(0, 184, 222))
midLine = plot(showMid ? mid : na, "Middle Line", color=color.rgb(209, 212, 220))
// Fill the area between bands
fill(upperBand, lowerBand, color=color.rgb(0, 184, 222, 90), title="Channel Fill")
Script de código abierto
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Exención de responsabilidad
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Script de código abierto
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Exención de responsabilidad
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.