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
ta.kc(series, length, mult, usetruerange) → [series float, series float, series float]Arguments
| Parameter | Type | Description |
|---|---|---|
| series | series int/float | Source series (typically price). |
| length | simple int | Length for the central average and band calculation. |
| mult | simple int/float | Multiplier applied to the range measure. |
| usetruerange | simple bool | Optional. 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
//@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
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.
Related Pine Script Functions
ta.kcw() - Keltner Channels Width
Learn how to use ta.kcw() in Pine Script. Syntax, parameters, code examples for Keltner Channel Width measurement.
ta.bb() - Bollinger Bands
Learn how to use ta.bb() in Pine Script. Syntax, parameters, code examples for Bollinger Bands with upper, middle, and lower bands.
ta.atr() - Average True Range
Learn how to use ta.atr() in Pine Script. Syntax, parameters, code examples for the Average True Range volatility indicator.
ta.ema() - Exponential Moving Average
Learn how to use ta.ema() in Pine Script. Syntax, parameters, code examples, and trading applications for the Exponential Moving Average function.
ta.stdev() - Standard Deviation
Learn how to use ta.stdev() in Pine Script. Syntax, parameters, code examples for statistical standard deviation calculation.