Skip to content
Algo Trade Analytics Docs

ta.kcw() - Pine Script Function

Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.

ta.kcw(series, length, mult, useTrueRange) → series float
NameTypeDescription
seriesseries int/floatSeries of values to process.

Keltner Channels Width.

  • na values in the source series are ignored; the function calculates on the length quantity of non-na values.
//@version=6
indicator("ta.kcw")
plot(ta.kcw(close, 5, 4), color=color.yellow)// the same on pinef_kcw(src, length, mult, useTrueRange) => float basis = ta.ema(src, length)
float span = (useTrueRange) ? ta.tr : (high - low)
float rangeEma = ta.ema(span, length) ((basis + rangeEma * mult) - (basis - rangeEma * mult)) / basis
plot(f_kcw(close, 5, 4, true))