Keltner Channels
Calculate the Keltner Channels for a given price series.
The Keltner Channels consist of three lines:
- Upper Channel Line = Exponential Moving Average (EMA) of High Prices + ATR * ATR Multiplier
- Middle Channel Line = Exponential Moving Average (EMA) of Closing Prices
- Lower Channel Line = Exponential Moving Average (EMA) of Low Prices - ATR * ATR Multiplier
The formula is as follows:
\[\text{EMA} = (\text{Close} - \text{Previous EMA}) \cdot (2 / (1 + \text{Window})) + \text{Previous EMA}\] \[\text{ATR} = \operatorname{EMA}(\text{TR},\; \text{ATR Window})\] \[\text{Upper Channel Line} = \operatorname{EMA}(\text{High},\; \text{Window}) + \text{ATR} \cdot \text{ATR Multiplier}\] \[\text{Middle Channel Line} = \operatorname{EMA}(\text{Close},\; \text{Window})\] \[\text{Lower Channel Line} = \operatorname{EMA}(\text{Low},\; \text{Window}) - \text{ATR} \cdot \text{ATR Multiplier}\]Also known as: ATR-based bands, volatility channels.
Keltner Channels in Python
get_keltner_channels is part of the Technicals module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_keltner_channels as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT"])
toolkit.technicals.get_keltner_channels().xs("AAPL", level=1, axis="columns")
Which returns:
| Date | Lower Line | Middle Line | Upper Line |
|---|---|---|---|
| 2026-06-18 | 282.479 | 298.807 | 315.134 |
| 2026-06-22 | 282.437 | 298.567 | 314.697 |
| 2026-06-23 | 282.108 | 297.998 | 313.888 |
| 2026-06-24 | 281.642 | 297.342 | 313.042 |
| 2026-06-25 | 276.478 | 294.383 | 312.289 |
| 2026-06-26 | 274.532 | 292.969 | 311.407 |
| 2026-06-29 | 274.137 | 291.472 | 308.808 |
| 2026-06-30 | 274.501 | 291.191 | 307.881 |
| 2026-07-01 | 274.923 | 291.616 | 308.309 |
| 2026-07-02 | 276.002 | 293.884 | 311.767 |
Parameters
get_keltner_channels accepts the following parameters:
- period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
- close_column (str, optional): The column name for closing prices in the historical data. Defaults to “Adj Close”.
- window (int, optional): Number of periods for the moving average. Defaults to 14.
- atr_window (int, optional): Number of periods for ATR calculation. Defaults to 14.
- atr_multiplier (int, optional): Multiplier for ATR to determine channel width. Defaults to 2.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the channels. Defaults to False.
- lag (int | list[int], optional): The lag to use for the growth calculation.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.