Docs

ta.kcw

Measure the width of the Keltner channel relative to its average, to spot compression.

itm
ta.kcw(source, length, mult, bars)

Keltner Channel width: (upper - lower) / basis = 2 * mult * ta.atr(length) / ta.ema(source, length). It uses the same true-range, Wilder-smoothed spread as ta.kc, so the two agree by construction. The bars come from bars. A fraction, not a percentage.

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.

Output

NameTypeUnit
valuenumber-

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. na when the basis is zero.

Example

itm
ta.kcw(close, 20, 2)
itm
plot(ta.kcw(close, 20, 2), "Channel width 20")