VolatilityPine Script v6

ta.kcw()Keltner Channels Width

The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.

Syntax

Syntax
ta.kcw(series, length, mult, usetruerange) → series float

Arguments

ParameterTypeDescription
seriesseries int/floatSource series (typically price).
lengthsimple intLength for the central average and band calculation.
multsimple int/floatMultiplier applied to the range measure.
usetruerangesimple boolOptional. If true, uses true range in the band width; default true.

Returns

Keltner Channels Width.

Remarks

Expresses channel width relative to the middle line, useful for comparing volatility compression and expansion over time.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.kcw")

plot(ta.kcw(close, 5, 4), color=color.yellow)

Trading Applications

Measure channel width for volatility analysis

Detect volatility contraction and expansion

Compare with BBW for squeeze confirmation

Monitor trend strength through channel width changes

Related Functions

Frequently Asked Questions

ta.kcw() quantifies how wide Keltner Channels are compared to the middle line. Like BBW for Bollinger Bands, it helps highlight low-volatility periods versus expanding volatility.

Track KCW over time: falling KCW suggests narrowing channels and calmer price action; rising KCW suggests widening channels and stronger intrabar movement relative to the middle line.

Squeeze setups often compare Bollinger Band width to Keltner-based measures. KCW is one way to characterize Keltner width; pair it with BBW or band position rules as your strategy requires.

Generate ta.kcw() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.kcw() and other built-in functions instantly.