VolatilityPine Script v6

ta.kc()

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

Syntax
ta.kc(series, length, mult, usetruerange) → [series float, series float, 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.

Remarks

Returns middle, upper, and lower channel values. The default uses true range for volatility in the channel width when usetruerange is true.

Code Examples

Pine Script v6 Example
//@version=6
indicator("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)

Trading Applications

Identify trend direction using channel slope

Detect overbought/oversold with price at channel extremes

Combine with Bollinger Bands for squeeze detection

Use as dynamic support and resistance levels

Related Functions

Frequently Asked Questions

Generate ta.kc() Code with AI

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