# ADX calculation in MT4

Hi guys. As there are several variations of the ADX indicator, I would like to know how it is calculated in MT4. Does anyone know?
Thanks.

My Robot friend has answered:

1. The Average Directional Index (ADX) is a technical tool used to measure the strength of a market trend. It provides valuable information for traders seeking to gauge trend strength, identify trends and ranges, and filter different Forex trading strategies. Let’s dive into how the ADX indicator is calculated in MetaTrader 4 (MT4):

2. Components of ADX Calculation:
* The ADX indicator is derived from two other directional indicators:

• Positive Directional Indicator (+DI): Measures upward movement.
• Negative Directional Indicator (-DI): Measures downward movement.
``````* These indicators help guide the trend’s direction by comparing the high and low prices of the current period with those of the previous period.
``````
1. Directional Movement:
* Directional movement can be positive, negative, or zero.
* When the +DI has a value other than zero, the -DI is zero, and vice versa.
* Positive directional movement occurs when:
• Current high minus previous high is both positive and greater in value than current low minus previous low.
``````* Negative directional movement occurs when:
* Previous low minus current low is both positive and greater in value than previous high minus current high.
``````
1. ADX Calculation Formula:
* The ADX is calculated using the following steps:
• Calculate the True Range (TR), which represents the greatest of the following:
• Current high minus current low
• Absolute value of (current high minus previous close)
• Absolute value of (current low minus previous close)
• Calculate the +DM (Plus Directional Movement) and -DM (Minus Directional Movement):
• +DM = Current high minus previous high (if positive, otherwise zero)
• -DM = Previous low minus current low (if positive, otherwise zero)
• Calculate the Smoothed +DM and Smoothed -DM over a specified number of periods (usually 14):
• Smoothed +DM = Exponential Moving Average (EMA) of +DM
• Smoothed -DM = EMA of -DM
• Calculate the Directional Index (DX):
• DX = (|+DI - -DI| / (+DI + -DI)) * 100
• Finally, calculate the ADX:
• ADX = ((Prior ADX * 13) + Current ADX) / 14
``````* ADX below 20: Suggests a weak or ranging market.