Investment Studio > Expressions > Functions > Indicator > ADX
float array[*][2] adx(float array[*][4] dhlc, integer days = 14, float previous_adx = 0)
Returns a two-column array containing dates (first column) and corresponding Average Directional movement indeX (ADX) values (second column). Given n input rows in dhlc, n - days + 1 rows are returned.
dhlc is a four-column array containing daily price quotes. Each row is structured as follows:
| Column # | Content |
| 1 | The quote date. |
| 2 | The day's high (highest traded price). |
| 3 | The day's low (lowest traded price). |
| 4 | The day's close (last traded price). |
The array is assumed to be time-sorted, with earlier dates preceding later dates.
Automatic type conversion allows the use of date strings as arguments instead of explicit date values.
If only daily closes are available, consider using ARO, RSI, TSI or VHF instead.
days > 1 serves a dual purpose: it's the number of trading days contributing to the calculation of each day's DX value (Directional indeX)
and it's a parameter used to compute the ADX from the DX by Wilder smoothing:
| previous ADX * (days - 1) + today's DX | ||
| ADX | = | ¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾ |
| days |
previous_adx is the ADX value on the trading date preceding the first date quoted in dhlc. If omitted, it defaults to 0. Note that Wilder smoothing causes the importance of this value to be successively reduced as later ADX values are computed.
Interpretation
ADX is a trend strength indicator ranging from 0 to 100. The higher the value, the stronger the trend, regardless of direction. Low values (ADX < 20) indicate a non-trending market in the time frame under study (determined by the days parameter). A cross above 20 indicates the start of a trend; values over 30 are generally seen as indication that a strong trend is in place.
The ADX turning down from levels over 30 is seen as a warning that the trend is running out of steam and may be about to reverse. When using the customary time frame days = 14, common wisdom is to then look for a retracement in price toward the 20 day EMA. In an uptrend, technical traders will buy when the price falls to the 20 day EMA; in a downtrend, they will sell when the price reaches the 20 day EMA.
A tenet of classic technical analysis worth keeping in mind when using the ADX is that the longer price keeps moving sideways (resulting in a low ADX reading < 20) the more likely it is to reverse the previous trend when it finally breaks out of its consolidation range.
For a real life example, consider Dell (NASD:DELL) from June 1 to December 31, 2001:

The top chart shows the price and a 20 day EMA (blue line). The bottom chart shows the 14 day ADX.
In June and July, the price showed little movement, and the ADX oscillated around the "no-trend" threshold of 20 (red horizontal line). In mid-August, a powerful downtrend emerged (first signalled by the price crossing below the 20 day EMA) which drove the ADX all the way up to 47 by September 4. Here, the ADX turned down, arguably giving rise to a false signal: traders following the standard rules would have considered buying here, with a view to sell later as the price moved up to meet its EMA. But instead of rising further, the price quickly turned down again. A saving grace is the fact that the EMA was already very close to the price by the time the September 4 top in the ADX became clearly established, making the trade unattractive anyway.
The "real" top in the ADX, signalling the end of the downtrend, turned out to be September 21. Unlike September 4, the distance between the EMA and the price made this an attractive entry point. The ADX then kept falling until October 10, where it stabilized at 28. Since the price had crossed above the 20 day EMA a week earlier (on October 3), this told traders that the previous downtrend in price had now been replaced by a (weaker) uptrend. This trend remained in place for the rest of the year: the ADX flirted with the "no-trend" 20 level a couple of times as the rally successively lost steam, but didn't cross below it until December 28.
It's worth noting that unlike the ADX, the ADXR did not give rise to a false signal on September 4.
Example
Assuming standard US date format settings,
=adx({{"1/1/1990", 100, 90, 98}, {"1/2/1990", 97, 84, 86}}, 2)
returns {{32875, 50}}. 32875 is the date code for 1/2/1990; 50 is the 2 day ADX value for that date, given an implied ADX of 0 on the trading day preceding 1/1/1990.