Calculate the Average Directional Index (ADX) for a given price series.

The Average Directional Index (ADX) is an indicator that measures the strength of a trend, whether it’s an uptrend or a downtrend.

The formula is as follows:

\[\text{ADX} = \text{Wilder's Smoothed Moving Average of DX},\;\; \text{where} \;\; \text{DX} = 100 \cdot | \text{+DI} - \text{-DI} | / (\text{+DI} + \text{-DI})\]

Also known as: ADX, trend strength indicator. See momentum_model.get_average_directional_index for the full formula, which uses Wilder’s smoothing (not a plain SMA) throughout.

Average Directional Index (ADX) in Python

get_average_directional_index is part of the Technicals module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_average_directional_index as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT"])

toolkit.technicals.get_average_directional_index()

Which returns:

Date AAPL MSFT Benchmark
2026-06-18 31.7885 26.0482 24.8516
2026-06-22 28.0539 27.1817 25.2744
2026-06-23 25.3719 29.9043 25.3022
2026-06-24 23.5607 33.0223 26.3917
2026-06-25 23.3155 36.6469 28.5969
2026-06-26 24.2698 40.1891 31.1122
2026-06-29 25.7674 43.281 33.5671
2026-06-30 27.545 44.9576 33.0473
2026-07-01 27.4563 45.3851 31.753
2026-07-02 27.743 43.8357 30.2519

Parameters

get_average_directional_index 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 in the historical data that represents the closing prices. Defaults to “Adj Close”.
  • window (int, optional): The number of periods to consider for the ADX calculation. Defaults to 14.
  • 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 indicator values. 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.
Share