The directional movement index (DMI) is an indicator that identifies in which direction the price of an asset is moving. The indicator does this by comparing prior highs and lows and drawing two lines: a positive directional movement line (+DI) and a negative directional movement line (-DI). Third line, called the average directional index (ADX), can also be used to gauge the strength of the uptrend or downtrend.

Register & Get Data

Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. A more detailed information about DMI and ADX function based on Technical Indicator API you can find on our documentation web-page.

Accessing the EODHD API

To access the EODHD API, we need to create an instance of the “APIClient” class and pass to it our API key. In this example, we will use the demo API key provided by EODHD, but in your real application, you should use your registered API key.

api = APIClient("demo")

Please, note that you can also specify the API key in a configuration file or as an environment variable, as described in the library documentation here.

1. Use the “DEMO” API key to test our data from a limited set of the tickers without registering:
Real-Time Data and All of the APIs (except Bulk) are included without limitations on API calls.
2. Register to get your free API key (limitated by 20 API calls per day) with access to:
End-Of-Day Historical Data with only past year for any ticker and List of tickers per Exchange.
3. To unlock your API key we recommend to choose subscription which covers your needs.

Exploring of DMI and ADX as a part of Technical Indicator API

After we are done with the API client, we can start requesting DMI and ADX from the Technical Indicators API.

dmi = api.get_technical_indicator_data(ticker =  "AAPL.US", function = "dmi") # for directional movement index
adx = api.get_technical_indicator_data(ticker = "AAPL.US", function = "adx") # for average directional movement index

The API response will be a single JSON structure.

Converting JSON Response to DataFrame

To convert JSON to DataFrame it is possible to use:

dmi_df =pd.DataFrame(dmi)
print(dmi) # for Directional Movement Index
adx_df = pd.DataFrame(adx)
print(adx) # for Average Directional Movement Index

All data in the DataFrame will contain information such as date and DMI or ADX (relatively to which parameter you call). All given information will be for stock symbol, which was used when we called API, in particular (“AAPL.US”).

Extended parameters of the DMI and ADX functions

For a more accurate research, it is possible to use parameters that lays in DMI and ADX.
For DMI and ADX only one parameter is available: period. Period is the number of data points used to calculate each weighted moving average value. The valid range is from 2 to 100000, with the default value being 50.

dmi_extended = api.get_technical_indicator_data(ticker = "AAPL.US", function = "dmi", period = 100)

The API response is a JSON array containing data for all the requested tickers. You can convert the resulting JSON array to a DataFrame for further analysis:

dmi_e = pd.DataFrame(dmi_extended)
print (dmi_e)


The Directional Movement Index (DMI) and Average Directional Index (ADX) are technical indicators providing invaluable insights into the direction and strength of asset price movements. By drawing on the power of EODHD’s Technical Indicator API, you can explore DMI and ADX for specific stock symbols and assess their significance. The period parameter allows for fine-tuning your research, providing a wealth of data for deeper analysis. Enhance your understanding of price trends and asset strength with DMI and ADX indicators, unlocking potential opportunities in the market.

Register & Get Data