Sidechair

ta.kc()

Browse the reference

Returns the Keltner Channels as three series: an EMA basis with bands mult times an averaged range above and below.

Try it in the editor

ta.kc returns [basis, upper, lower]. The basis is ta.ema(series, length), and the band offset is mult times an EMA of the bar range over the same length. The range is the true range, or high - low when useTrueRange is false.

With the true range, the first values appear on bar number length + 1, since the first bar has no previous close.

Syntax

Pine Script
ta.kc(series: series int/float, length: simple int, mult: simple int/float, useTrueRange: simple bool) -> [series float, series float, series float]

Arguments

NameTypeDefaultDescription
seriesseries int/floatrequiredSeries for the basis, usually close.
lengthsimple intrequiredLength of both EMAs. A whole number of 1 or more.
multsimple int/floatrequiredMultiplier applied to the averaged range.
useTrueRangesimple booltruetrue averages the true range; false averages plain high - low.

Returns

[series float, series float, series float]: the basis, the upper channel and the lower channel.

Remarks

  • Keltner Channels follow smoothed range, so they react less to a single outlier close than Bollinger Bands do.

Example

Pine ScriptKeltner ChannelsOpen in editor
//@version=6
indicator("Keltner Channels", overlay = true)
[mid, upper, lower] = ta.kc(close, 20, 1.5)
plot(mid, "Basis", color = color.gray)
plot(upper, "Upper", color = color.green)
plot(lower, "Lower", color = color.red)

See also

Runs on Sidechair