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.

TradingView language reference

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

ta.kc() uses an EMA of the source as its basis. Band distance is mult times an EMA of true range by default, or of high - low when useTrueRange is false. This is not the RMA-smoothed ta.atr() calculation.

Bollinger Bands use standard deviation around an SMA, so width reflects statistical dispersion. ta.kc() uses an EMA-smoothed range multiplied by mult around an EMA basis; changing the range choice changes its width.

The TTM Squeeze idea compares when Bollinger Bands move inside Keltner Channels (low volatility compression) versus when they expand outside (potential volatility expansion). Implementations vary; confirm logic in your script or platform.

Generate ta.kc() Code with AI

Draft Pine Script using ta.kc() with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.