Lipi Reference Lipi

Functions

talib.kcw()

Keltner channel width for `source` over `length` bars: one figure in place of the three the channel call returns. The argument list matches `talib.kc`, `useTrueRange` included.

Syntax

                talib.kcw(series float source, series int length, series int mult, series bool useTrueRange) → series float
              

Arguments

source required series float The series the channels are built on.
length required series int How many bars the calculation covers.
mult required series int Band multiplier. An int, not a float: a fractional multiplier is refused when the script is checked, and there is no rounding.
useTrueRange series bool Optional flag selecting true range for the width.

Return Type

series float

Example


          indicator("Keltner Channel Width (KCW)", overlay=false)
length = input(20, "Length")
mult = input(2, "Multiplier")
source = input(close, "Source")
kcWidth = talib.kcw(source, length, mult)
plot(kcWidth, color=color.blue, title="KC Width", style=plotStyle.histogram)
hline(0, "Zero Line", color=color.gray)