Keltner Channels (KC)
Summary
Keltner Channels: three overlap lines around price. The centre line is an exponential moving average of the typical price; the outer bands sit a multiple of the Average True Range above and below it. The band width tracks volatility, so the channel widens in fast markets and narrows in quiet ones.
Formula
TP = (High + Low + Close) / 3 Middle = EMA(TP, N) Band = ATR(M) Upper = Middle + Deviations * Band Lower = Middle - Deviations * Band
Notes
- Several incompatible indicators are published under the name "Keltner Channel", disagreeing by percent rather than by rounding. This is the typical-price centre line with a Wilder-smoothed Average True Range band, the form implemented by TTR and ta4j.
- Chester Keltner's 1960 original smooths the typical price with a simple moving average and takes the band from the plain daily range; the widely charted modern variant centres on the close instead. Expect a visible difference against a package plotting either.
- TTR ties the Average True Range period to the centre line's period. Here the two are independent, so the band width can be tuned separately.
- The centre line and the band are separate recursions, each with its own warm-up. They are entered at their own lookbacks, so a caller who wants either one converged sets that function's unstable period —
TA_FUNC_UNST_EMAfor the centre line,TA_FUNC_UNST_ATRfor the band.
Inputs
inHigh— High price of each barinLow— Low price of each barinClose— Close price of each bar
Outputs
outRealUpperBand— Centre line plus the scaled Average True RangeoutRealMiddleBand— Exponential moving average of the typical priceoutRealLowerBand— Centre line minus the scaled Average True Range
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 20 | 2–100000 | Smoothing period of the typical price moving average |
optInATRPeriod | integer | 10 | 1–100000 | Smoothing period of the Average True Range |
optInNbDev | real | 2 | any real | Multiplier applied to the Average True Range |
Properties
Numerical Stability: Initial Unstable Period — Inherited from ATR and EMA, which KC computes internally; tunable via ATR and EMA's unstable period.
| ✅ Overlap Input i |
| ☐ Independent Y-Axis |
| ☐ Candlestick |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: kc.c · kc.yaml
| Native | File |
|---|---|
| C | ta_KC.c |
| Rust | kc.rs |
| Java | Core_KC.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Keltner Channel
See Also
EMA · ATR · TYPPRICE · BBANDS · ACCBANDS