Skip to content
Algo Trade Analytics Docs

ta.kc() - Pine Script Function

Keltner Channels. Keltner channel is a technical analysis indicator showing a central moving average line plus channel lines at a distance above and below.

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

Keltner Channels.

  • na values in the source series are ignored; the function calculates on the length quantity of non-na values.
//@version=6
indicator("ta.kc")[middle, upper, lower] = ta.kc(close, 5, 4)
plot(middle, color=color.yellow)
plot(upper, color=color.yellow)
plot(lower, color=color.yellow)// the same on pinef_kc(src, length, mult, useTrueRange) => float basis = ta.ema(src, length)
float span = (useTrueRange) ? ta.tr : (high - low)
float rangeEma = ta.ema(span, length) [basis, basis + rangeEma * mult, basis - rangeEma * mult][pineMiddle, pineUpper, pineLower] = f_kc(close, 5, 4, true)
plot(pineMiddle)
plot(pineUpper)
plot(pineLower)