Sidechair

ta.kcw()

Browse the reference

Returns the Keltner Channel width: the distance between the upper and lower channel divided by the basis.

Try it in the editor

ta.kcw is (upper - lower) / basis for ta.kc with the same arguments. It is a relative measure, so readings compare across price levels and symbols.

Compare it with ta.bbw to find squeezes, where the Bollinger Bands move inside the Keltner Channels.

Syntax

Pine Script
ta.kcw(series: series int/float, length: simple int, mult: simple int/float, useTrueRange: simple bool) -> 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: the relative channel width.

Remarks

  • The width equals 2 * mult * averagedRange / basis.

Example

Pine ScriptKeltner width against Bollinger widthOpen in editor
//@version=6
indicator("Channel widths")
plot(ta.kcw(close, 20, 1.5), "Keltner width", color = color.green)
plot(ta.bbw(close, 20, 2), "Bollinger width", color = color.blue)

See also

Runs on Sidechair