Calculate the Keltner Channels for a given price series.

The Keltner Channels consist of three lines: a middle line, the Exponential Moving Average (EMA) of the closing prices, and an upper and a lower line a multiple of the Average True Range (ATR) above and below it.

The formula is as follows:

\[\text{Middle Line} = \operatorname{EMA}(\text{Close},\; \text{window})\] \[\text{Upper Line} = \text{Middle Line} + \text{atr\_multiplier} \cdot \operatorname{ATR}(\text{atr\_window})\] \[\text{Lower Line} = \text{Middle Line} - \text{atr\_multiplier} \cdot \operatorname{ATR}(\text{atr\_window}),\;\; \text{where the ATR uses Wilder's smoothing}\]

Also known as: ATR-based bands, volatility channels.

Keltner Channels in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_keltner_channels as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["^GDAXI"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_keltner_channels().xs("^GDAXI", level=1, axis="columns").tail(5)

Or, after setting up the Finance Toolkit MCP, ask:

Where were the Keltner Channels of the DAX from 24 to 31 December 2025?

Which returns:

Date Lower Line Middle Line Upper Line
2025-12-24 23674 24088.6 24503.2
2025-12-26 23715.1 24113.2 24511.4
2025-12-29 23750.5 24135.9 24521.3
2025-12-30 23782.9 24169.6 24556.4
2025-12-31 23782.9 24169.6 24556.4

Parameters

get_keltner_channels accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Can be “intraday”, “daily”, “weekly”, “monthly”, “quarterly” or “yearly”. Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the open, high and low prices are adjusted for dividends in the same way."Close"
windowintNumber of periods for the Exponential Moving Average (the middle line). Defaults to 20, as on StockCharts.20
atr_windowintNumber of periods for ATR calculation. Defaults to 10, as on StockCharts.10
atr_multiplierfloatMultiplier for ATR to determine channel width. Defaults to 2.3
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the channels. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
Share