ta.kcw() - Pine Script Function
ta.kcw()
Section titled “ta.kcw()”Overview
Section titled “Overview”Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.
Syntax
Section titled “Syntax”ta.kcw(series, length, mult, useTrueRange) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| series | series int/float | Series of values to process. |
Returns
Section titled “Returns”Keltner Channels Width.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("ta.kcw")plot(ta.kcw(close, 5, 4), color=color.yellow)// the same on pinef_kcw(src, length, mult, useTrueRange) => float basis = ta.ema(src, length)float span = (useTrueRange) ? ta.tr : (high - low)float rangeEma = ta.ema(span, length) ((basis + rangeEma * mult) - (basis - rangeEma * mult)) / basisplot(f_kcw(close, 5, 4, true))