Average Directional Index (ADX)
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})\]The ADX measures trend strength, not direction: a reading above about 25 is usually taken as a trending market and below 20 as a range, whether prices are rising or falling. Traders combine it with the +DI and -DI lines it is built from, which this method does not return, or with the price itself, to know the direction. With Wilder’s smoothing it reacts slowly and needs a few times the window of history before its values settle.
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 or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_average_directional_index as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
tickers=["USDJPY"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.technicals.get_average_directional_index().tail(5)
Or, after setting up the Finance Toolkit MCP, ask:
How strong was the trend of the dollar against the yen from 26 to 31 December 2025, measured by the Average Directional Index?
Which returns:
| Date | USDJPY | Benchmark |
|---|---|---|
| 2025-12-26 | 12.9299 | 17.7945 |
| 2025-12-28 | 12.0721 | 18.0251 |
| 2025-12-29 | 11.4398 | 17.7259 |
| 2025-12-30 | 11.0738 | 17.448 |
| 2025-12-31 | 10.4431 | 16.6228 |
Parameters
get_average_directional_index accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The time period to consider for historical data. Can be “intraday”, “daily”, “weekly”, “monthly”, “quarterly” or “yearly”. Defaults to “daily”. | "weekly" |
close_column | str | The column in the historical data that represents 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 to consider for the ADX calculation. Defaults to 14. | 20 |
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 indicator values. 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 |