ta.kc() - Pine Script Function
ta.kc()
Section titled “ta.kc()”Overview
Section titled “Overview”Keltner Channels. Keltner channel is a technical analysis indicator showing a central moving average line plus channel lines at a distance above and below.
Syntax
Section titled “Syntax”ta.kc(series, length, mult, useTrueRange) → [series float, series float, series float]Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| series | series int/float | Series of values to process. |
Returns
Section titled “Returns”Keltner Channels.
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.kc")[middle, upper, lower] = ta.kc(close, 5, 4)plot(middle, color=color.yellow)plot(upper, color=color.yellow)plot(lower, color=color.yellow)// the same on pinef_kc(src, length, mult, useTrueRange) => float basis = ta.ema(src, length)float span = (useTrueRange) ? ta.tr : (high - low)float rangeEma = ta.ema(span, length) [basis, basis + rangeEma * mult, basis - rangeEma * mult][pineMiddle, pineUpper, pineLower] = f_kc(close, 5, 4, true)plot(pineMiddle)plot(pineUpper)plot(pineLower)