Docs

ta.kc

Draw channels around an average at multiples of the average true range.

itm
ta.kc(source, length, mult, bars, useTrueRange)

Keltner Channels: [ema(source, length), basis + mult*atr(length), basis - mult*atr(length)], the atr read from bars. With useTrueRange=false the width uses the average of high minus low instead of the true range.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeUnitDefaultRangeDescription
sourceSeriesnumber---The series to read.
lengthConstantnumber-201 to 10000Window in observed bars.
multConstantnumber-20.001 to 50Multiples of the average true range from the basis.
barsConstantbarsbarsna-Which bars to read: a declared series, or na for the chart's own.
useTrueRangeConstantbool-true-true: the channel width is the average true range, which counts gaps between bars. false: it is the average of high minus low, smoothed the same way (an option, written useTrueRange=false).

Outputs

NameTypeUnit
middlenumber-
uppernumber-
lowernumber-

The outputs come back in this order: [middle, upper, lower] = ta.kc(…).

Warm-up and missing values

Warm-up
length bars. Names in the warm-up are this operator’s parameters.
Missing values
na until both the exponential average that forms the basis and the average true range have warmed up over length bars.

Example

itm
[basis, upper, lower] = ta.kc(close, 20, 2)
itm
[basis, upper, lower] = ta.kc(close, 20, 2)
plot(upper, "Upper")
plot(lower, "Lower")