Adaptive Price Zone (APZ)

Calculate Leibfarth’s Adaptive Price Zone (APZ): bands around a double-smoothed exponential moving average that adapt to the range, which show turning points in a sideways market.

The Adaptive Price Zone is a band around a fast, double-smoothed Exponential Moving Average of the close, with a width that is the same double-smoothed average of the High - Low range. Both averages use the square root of window as their period, so the zone follows the price closely. Leibfarth designed it for markets without a trend (an ADX below 30): a close above the zone is a chance to sell, and a close below it a chance to buy, in anticipation of a reversal.

The formula is as follows:

\[\text{Smoothing Period} = \sqrt{\text{window}}\] \[\text{Middle Band} = \operatorname{EMA}(\operatorname{EMA}(\text{Close},\; \text{Smoothing Period}),\; \text{Smoothing Period})\] \[\text{Range} = \operatorname{EMA}(\operatorname{EMA}(\text{High} - \text{Low},\; \text{Smoothing Period}),\; \text{Smoothing Period})\] \[\text{Upper Band} = \text{Middle Band} + \text{multiplier} \cdot \text{Range}\] \[\text{Lower Band} = \text{Middle Band} - \text{multiplier} \cdot \text{Range}\]

Also known as: APZ, Adaptive Price Zone.

Example · QQQ · 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_adaptive_price_zone:

from financetoolkit import Toolkit

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

toolkit.technicals.get_adaptive_price_zone().xs("QQQ", level=1, axis="columns")

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

How did the Adaptive Price Zone of the Invesco QQQ ETF move with its price in 2025?

Which returns:

Parameters

get_adaptive_price_zone accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). 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"
windowintThe number of periods whose square root is the smoothing period. Defaults to 20, as in Leibfarth’s article.20
multiplierfloatThe number of smoothed ranges between the middle band and the outer bands. Defaults to 2.0.2.0
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 bands. 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
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Leibfarth, L. (2006). “Trading With An Adaptive Price Zone.” Technical Analysis of Stocks & Commodities, 24(9).
  • Library Shares similar logic as finta’s APZ
Share