talib.kc

Keltner channels for source over length bars, with mult setting the distance to the outer bands. An optional useTrueRange flag selects true range for the width calculation. As with talib.bb, mult is an int, so a fractional multiplier is not accepted.

talib.kc(series float source, series int length, series int mult, series bool useTrueRange) → [series float, series float, series float]
ParameterTypeRequiredDescription
sourceseries floatyesThe series the channels are built on.
lengthseries intyesHow many bars the calculation covers.
multseries intyesBand multiplier. An int, not a float: a fractional multiplier is refused when the script is checked, and there is no rounding.
useTrueRangeseries boolnoOptional flag selecting true range for the width.

Returns [series float, series float, series float] — Three series float values as a tuple, in the order middle, upper, lower - the same shape as talib.bb.

indicator("Keltner channel")
[middle, upper, lower] = talib.kc(close, 20, 2)
plot(middle, title = "Middle")
plot(upper, title = "Upper")
plot(lower, title = "Lower")

See also talib.alma · talib.atr · talib.barssince

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade