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]| Parameter | Type | Required | Description |
|---|---|---|---|
source | series float | yes | The series the channels are built on. |
length | series int | yes | How many bars the calculation covers. |
mult | series int | yes | Band multiplier. An int, not a float: a fractional multiplier is refused when the script is checked, and there is no rounding. |
useTrueRange | series bool | no | Optional 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.