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:
| Date | Lower Band | Middle Band | Upper Band |
|---|---|---|---|
| 2025-01-02 | 498.383 | 514.660 | 530.938 |
| 2025-01-03 | 497.414 | 513.674 | 529.934 |
| 2025-01-06 | 498.497 | 514.138 | 529.779 |
| 2025-01-07 | 497.215 | 513.885 | 530.554 |
| 2025-01-08 | 496.849 | 513.388 | 529.927 |
| 2025-01-10 | 495.483 | 511.789 | 528.096 |
| 2025-01-13 | 494.036 | 509.744 | 525.453 |
| 2025-01-14 | 492.090 | 507.730 | 523.370 |
| 2025-01-15 | 492.320 | 507.536 | 522.752 |
| 2025-01-16 | 492.989 | 507.621 | 522.252 |
| 2025-01-17 | 493.609 | 508.954 | 524.299 |
| 2025-01-21 | 495.869 | 511.017 | 526.165 |
| 2025-01-22 | 499.734 | 513.987 | 528.240 |
| 2025-01-23 | 503.944 | 517.075 | 530.206 |
| 2025-01-24 | 506.980 | 519.399 | 531.818 |
| 2025-01-27 | 506.513 | 519.063 | 531.614 |
| 2025-01-28 | 504.809 | 518.708 | 532.607 |
| 2025-01-29 | 504.169 | 518.262 | 532.355 |
| 2025-01-30 | 503.755 | 518.134 | 532.512 |
| 2025-01-31 | 502.740 | 518.049 | 533.359 |
| 2025-02-03 | 501.206 | 517.441 | 533.676 |
| 2025-02-04 | 501.283 | 517.544 | 533.806 |
| 2025-02-05 | 502.443 | 518.236 | 534.029 |
| 2025-02-06 | 504.864 | 519.437 | 534.010 |
| 2025-02-07 | 505.037 | 519.797 | 534.557 |
| 2025-02-10 | 506.789 | 520.609 | 534.430 |
| 2025-02-11 | 508.649 | 521.328 | 534.008 |
| 2025-02-12 | 509.510 | 521.955 | 534.399 |
| 2025-02-13 | 510.917 | 523.466 | 536.016 |
| 2025-02-14 | 513.676 | 525.431 | 537.186 |
| 2025-02-18 | 516.563 | 527.477 | 538.391 |
| 2025-02-19 | 519.032 | 529.302 | 539.573 |
| 2025-02-20 | 520.094 | 530.492 | 540.890 |
| 2025-02-21 | 517.367 | 529.789 | 542.212 |
| 2025-02-24 | 513.491 | 527.596 | 541.702 |
| 2025-02-25 | 508.713 | 524.229 | 539.745 |
| 2025-02-26 | 504.795 | 521.003 | 537.210 |
| 2025-02-27 | 497.012 | 516.371 | 535.730 |
| 2025-02-28 | 491.658 | 512.839 | 534.021 |
| 2025-03-03 | 484.508 | 508.749 | 532.990 |
| 2025-03-04 | 478.308 | 504.781 | 531.254 |
| 2025-03-05 | 475.136 | 502.249 | 529.361 |
| 2025-03-06 | 471.776 | 498.803 | 525.831 |
| 2025-03-07 | 469.165 | 495.926 | 522.687 |
| 2025-03-10 | 464.002 | 491.137 | 518.271 |
| 2025-03-11 | 459.282 | 486.068 | 512.855 |
| 2025-03-12 | 456.745 | 482.269 | 507.793 |
| 2025-03-13 | 454.137 | 478.352 | 502.567 |
| 2025-03-14 | 453.985 | 476.410 | 498.834 |
| 2025-03-17 | 455.096 | 475.934 | 496.772 |
| 2025-03-18 | 455.699 | 475.022 | 494.346 |
| 2025-03-19 | 455.995 | 474.898 | 493.801 |
| 2025-03-20 | 456.465 | 474.892 | 493.317 |
| 2025-03-21 | 457.065 | 475.142 | 493.220 |
| 2025-03-24 | 459.452 | 476.861 | 494.269 |
| 2025-03-25 | 463.650 | 479.312 | 494.975 |
| 2025-03-26 | 464.916 | 480.527 | 496.138 |
| 2025-03-27 | 465.531 | 480.715 | 495.899 |
| 2025-03-28 | 462.490 | 478.783 | 495.075 |
| 2025-03-31 | 458.366 | 476.252 | 494.139 |
| 2025-04-01 | 455.738 | 474.320 | 492.903 |
| 2025-04-02 | 453.330 | 473.345 | 493.360 |
| 2025-04-03 | 448.951 | 469.504 | 490.057 |
| 2025-04-04 | 438.590 | 461.309 | 484.029 |
| 2025-04-07 | 421.223 | 452.592 | 483.960 |
| 2025-04-08 | 404.308 | 443.816 | 483.324 |
| 2025-04-09 | 391.404 | 442.814 | 494.224 |
| 2025-04-10 | 387.021 | 442.446 | 497.872 |
| 2025-04-11 | 389.998 | 443.473 | 496.948 |
| 2025-04-14 | 396.492 | 445.333 | 494.175 |
| 2025-04-15 | 405.244 | 447.348 | 489.452 |
| 2025-04-16 | 409.614 | 447.324 | 485.034 |
| 2025-04-17 | 413.872 | 446.471 | 479.070 |
| 2025-04-21 | 414.797 | 443.942 | 473.086 |
| 2025-04-22 | 416.079 | 442.583 | 469.086 |
| 2025-04-23 | 418.528 | 443.214 | 467.899 |
| 2025-04-24 | 422.464 | 446.258 | 470.053 |
| 2025-04-25 | 428.259 | 450.559 | 472.859 |
| 2025-04-28 | 433.722 | 454.771 | 475.820 |
| 2025-04-29 | 439.253 | 458.799 | 478.344 |
| 2025-04-30 | 441.958 | 462.206 | 482.454 |
| 2025-05-01 | 446.198 | 465.732 | 485.267 |
| 2025-05-02 | 451.533 | 469.784 | 488.035 |
| 2025-05-05 | 456.517 | 473.121 | 489.725 |
| 2025-05-06 | 459.582 | 475.125 | 490.668 |
| 2025-05-07 | 461.143 | 476.576 | 492.009 |
| 2025-05-08 | 462.682 | 478.272 | 493.861 |
| 2025-05-09 | 464.810 | 479.797 | 494.784 |
| 2025-05-12 | 469.244 | 483.687 | 498.131 |
| 2025-05-13 | 474.362 | 489.037 | 503.712 |
| 2025-05-14 | 480.938 | 494.669 | 508.400 |
| 2025-05-15 | 486.428 | 499.738 | 513.049 |
| 2025-05-16 | 491.621 | 504.204 | 516.787 |
| 2025-05-19 | 495.087 | 507.896 | 520.705 |
| 2025-05-20 | 498.231 | 510.553 | 522.874 |
| 2025-05-21 | 497.879 | 511.478 | 525.078 |
| 2025-05-22 | 497.978 | 511.711 | 525.444 |
| 2025-05-23 | 497.389 | 511.002 | 524.615 |
| 2025-05-27 | 497.963 | 511.598 | 525.233 |
| 2025-05-28 | 499.107 | 512.333 | 525.559 |
| 2025-05-29 | 499.437 | 513.162 | 526.887 |
| 2025-05-30 | 499.394 | 513.808 | 528.222 |
| 2025-06-02 | 500.089 | 514.839 | 529.589 |
| 2025-06-03 | 501.909 | 516.429 | 530.950 |
| 2025-06-04 | 504.712 | 518.227 | 531.742 |
| 2025-06-05 | 505.280 | 519.341 | 533.403 |
| 2025-06-06 | 507.356 | 520.711 | 534.067 |
| 2025-06-09 | 509.931 | 522.105 | 534.278 |
| 2025-06-10 | 512.121 | 523.787 | 535.453 |
| 2025-06-11 | 513.449 | 525.122 | 536.795 |
| 2025-06-12 | 515.181 | 526.305 | 537.430 |
| 2025-06-13 | 515.333 | 526.380 | 537.427 |
| 2025-06-16 | 516.126 | 526.971 | 537.816 |
| 2025-06-17 | 516.247 | 527.000 | 537.753 |
| 2025-06-18 | 516.140 | 526.787 | 537.433 |
| 2025-06-20 | 514.734 | 526.218 | 537.701 |
| 2025-06-23 | 513.750 | 526.300 | 538.850 |
| 2025-06-24 | 515.234 | 527.714 | 540.193 |
| 2025-06-25 | 517.830 | 529.658 | 541.485 |
| 2025-06-26 | 520.874 | 532.227 | 543.581 |
| 2025-06-27 | 523.861 | 534.954 | 546.047 |
| 2025-06-30 | 527.338 | 537.851 | 548.364 |
| 2025-07-01 | 529.330 | 539.812 | 550.295 |
| 2025-07-02 | 531.275 | 541.641 | 552.006 |
| 2025-07-03 | 533.889 | 543.891 | 553.893 |
| 2025-07-07 | 535.671 | 545.454 | 555.238 |
| 2025-07-08 | 537.412 | 546.573 | 555.735 |
| 2025-07-09 | 538.993 | 547.883 | 556.774 |
| 2025-07-10 | 540.187 | 548.989 | 557.792 |
| 2025-07-11 | 541.114 | 549.699 | 558.283 |
| 2025-07-14 | 541.658 | 550.421 | 559.184 |
| 2025-07-15 | 542.356 | 551.120 | 559.884 |
| 2025-07-16 | 541.900 | 551.791 | 561.682 |
| 2025-07-17 | 542.583 | 552.961 | 563.339 |
| 2025-07-18 | 543.654 | 554.103 | 564.553 |
| 2025-07-21 | 545.324 | 555.469 | 565.614 |
| 2025-07-22 | 546.162 | 556.354 | 566.545 |
| 2025-07-23 | 547.284 | 557.267 | 567.250 |
| 2025-07-24 | 548.880 | 558.229 | 567.578 |
| 2025-07-25 | 550.506 | 559.263 | 568.019 |
| 2025-07-28 | 552.498 | 560.422 | 568.346 |
| 2025-07-29 | 553.348 | 561.361 | 569.373 |
| 2025-07-30 | 553.728 | 562.186 | 570.643 |
| 2025-07-31 | 552.091 | 562.455 | 572.820 |
| 2025-08-01 | 549.289 | 560.987 | 572.684 |
| 2025-08-04 | 548.274 | 560.372 | 572.470 |
| 2025-08-05 | 547.218 | 559.675 | 572.132 |
| 2025-08-06 | 547.142 | 559.973 | 572.805 |
| 2025-08-07 | 547.439 | 560.888 | 574.337 |
| 2025-08-08 | 549.506 | 562.634 | 575.762 |
| 2025-08-11 | 551.621 | 564.255 | 576.889 |
| 2025-08-12 | 553.731 | 566.566 | 579.402 |
| 2025-08-13 | 556.519 | 568.885 | 581.250 |
| 2025-08-14 | 559.258 | 570.837 | 582.415 |
| 2025-08-15 | 561.192 | 572.042 | 582.891 |
| 2025-08-18 | 562.976 | 572.754 | 582.533 |
| 2025-08-19 | 561.885 | 572.134 | 582.382 |
| 2025-08-20 | 558.990 | 570.611 | 582.231 |
| 2025-08-21 | 556.495 | 568.579 | 580.664 |
| 2025-08-22 | 554.265 | 567.769 | 581.274 |
| 2025-08-25 | 553.970 | 567.339 | 580.708 |
| 2025-08-26 | 554.802 | 567.425 | 580.048 |
| 2025-08-27 | 556.113 | 567.822 | 579.532 |
| 2025-08-28 | 557.521 | 568.770 | 580.019 |
| 2025-08-29 | 557.640 | 568.925 | 580.210 |
| 2025-09-02 | 556.606 | 568.105 | 579.605 |
| 2025-09-03 | 556.224 | 567.594 | 578.964 |
| 2025-09-04 | 556.416 | 567.960 | 579.504 |
| 2025-09-05 | 556.122 | 568.741 | 581.360 |
| 2025-09-08 | 557.776 | 569.957 | 582.139 |
| 2025-09-09 | 559.990 | 571.405 | 582.819 |
| 2025-09-10 | 561.810 | 572.777 | 583.744 |
| 2025-09-11 | 564.197 | 574.384 | 584.572 |
| 2025-09-12 | 566.702 | 576.214 | 585.726 |
| 2025-09-15 | 569.658 | 578.556 | 587.455 |
| 2025-09-16 | 572.632 | 580.725 | 588.818 |
| 2025-09-17 | 573.730 | 582.378 | 591.025 |
| 2025-09-18 | 575.217 | 584.308 | 593.400 |
| 2025-09-19 | 577.457 | 586.628 | 595.799 |
| 2025-09-22 | 579.918 | 589.266 | 598.614 |
| 2025-09-23 | 581.491 | 591.148 | 600.804 |
| 2025-09-24 | 581.964 | 592.194 | 602.424 |
| 2025-09-25 | 581.568 | 592.423 | 603.278 |
| 2025-09-26 | 581.567 | 592.617 | 603.666 |
| 2025-09-29 | 582.251 | 593.137 | 604.023 |
| 2025-09-30 | 583.346 | 593.938 | 604.529 |
| 2025-10-01 | 584.088 | 595.127 | 606.167 |
| 2025-10-02 | 585.774 | 596.644 | 607.514 |
| 2025-10-03 | 586.822 | 597.751 | 608.680 |
| 2025-10-06 | 588.752 | 599.147 | 609.541 |
| 2025-10-07 | 589.481 | 600.048 | 610.615 |
| 2025-10-08 | 590.600 | 601.550 | 612.501 |
| 2025-10-09 | 592.255 | 602.996 | 613.736 |
| 2025-10-10 | 585.769 | 601.407 | 617.044 |
| 2025-10-13 | 583.430 | 600.471 | 617.513 |
| 2025-10-14 | 580.721 | 599.391 | 618.061 |
| 2025-10-15 | 579.262 | 598.957 | 618.653 |
| 2025-10-16 | 577.662 | 598.546 | 619.430 |
| 2025-10-17 | 577.719 | 598.722 | 619.725 |
| 2025-10-20 | 580.354 | 600.123 | 619.892 |
| 2025-10-21 | 584.273 | 601.809 | 619.345 |
| 2025-10-22 | 585.204 | 602.601 | 619.998 |
| 2025-10-23 | 586.765 | 603.604 | 620.443 |
| 2025-10-24 | 590.186 | 605.425 | 620.665 |
| 2025-10-27 | 595.032 | 608.794 | 622.556 |
| 2025-10-28 | 600.204 | 612.977 | 625.750 |
| 2025-10-29 | 604.843 | 617.309 | 629.775 |
| 2025-10-30 | 607.142 | 619.829 | 632.517 |
| 2025-10-31 | 608.607 | 621.685 | 634.764 |
| 2025-11-03 | 610.350 | 623.426 | 636.503 |
| 2025-11-04 | 609.596 | 623.182 | 636.769 |
| 2025-11-05 | 608.234 | 622.708 | 637.182 |
| 2025-11-06 | 604.640 | 620.660 | 636.680 |
| 2025-11-07 | 600.494 | 617.996 | 635.497 |
| 2025-11-10 | 599.500 | 617.233 | 634.966 |
| 2025-11-11 | 600.276 | 617.117 | 633.957 |
| 2025-11-12 | 601.105 | 617.211 | 633.318 |
| 2025-11-13 | 598.832 | 615.692 | 632.553 |
| 2025-11-14 | 594.573 | 613.788 | 633.002 |
| 2025-11-17 | 590.342 | 611.291 | 632.239 |
| 2025-11-18 | 586.146 | 607.912 | 629.677 |
| 2025-11-19 | 582.838 | 605.102 | 627.366 |
| 2025-11-20 | 573.733 | 601.009 | 628.285 |
| 2025-11-21 | 567.563 | 597.532 | 627.500 |
| 2025-11-24 | 566.659 | 596.772 | 626.885 |
| 2025-11-25 | 568.115 | 597.705 | 627.294 |
| 2025-11-26 | 572.941 | 599.909 | 626.878 |
| 2025-11-28 | 579.646 | 602.993 | 626.341 |
| 2025-12-01 | 585.132 | 605.743 | 626.355 |
| 2025-12-02 | 590.239 | 608.633 | 627.028 |
| 2025-12-03 | 594.705 | 611.396 | 628.086 |
| 2025-12-04 | 598.450 | 613.661 | 628.872 |
| 2025-12-05 | 601.792 | 615.761 | 629.730 |
| 2025-12-08 | 603.850 | 617.354 | 630.858 |
| 2025-12-09 | 605.825 | 618.633 | 631.441 |
| 2025-12-10 | 606.952 | 619.955 | 632.958 |
| 2025-12-11 | 607.360 | 620.848 | 634.335 |
| 2025-12-12 | 604.739 | 619.858 | 634.978 |
| 2025-12-15 | 601.657 | 617.834 | 634.011 |
| 2025-12-16 | 599.627 | 615.824 | 632.020 |
| 2025-12-17 | 594.984 | 612.580 | 630.177 |
| 2025-12-18 | 593.023 | 610.430 | 627.838 |
| 2025-12-19 | 593.528 | 610.063 | 626.598 |
| 2025-12-22 | 595.848 | 610.857 | 625.865 |
| 2025-12-23 | 598.776 | 612.397 | 626.019 |
| 2025-12-24 | 602.350 | 614.275 | 626.200 |
| 2025-12-26 | 605.750 | 616.032 | 626.315 |
| 2025-12-29 | 607.778 | 617.105 | 626.431 |
| 2025-12-30 | 609.082 | 617.566 | 626.050 |
| 2025-12-31 | 608.453 | 617.038 | 625.623 |
250 rows
Parameters
get_adaptive_price_zone accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The 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_column | str | The 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" |
window | int | The number of periods whose square root is the smoothing period. Defaults to 20, as in Leibfarth’s article. | 20 |
multiplier | float | The number of smoothed ranges between the middle band and the outer bands. Defaults to 2.0. | 2.0 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the bands. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether 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_columns | str | list[str] | None | The 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