Investment Studio > Expressions > Functions > Indicator > DI
float array[*][2] di(float array[*][4] dhlc)
Returns a two-column array containing dates (first column) and corresponding Directional Indicator (DI) values (second column). Given n input rows in dhlc, n - 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.
Interpretation
DI is a daily velocity indicator. It's defined as the largest part of the day's price range which lies outside the previous day's price range (see DM), divided by the day's True Range (see TR). Since TR is a daily volatility indicator, this ratio can be seen as a measure of the significance (signal/noise ratio) of each day's price action. The larger the absolute value (abs), the more important the day.
The sign is positive if the upside dominates (day's high - previous day's high > previous day's low - day's low); it's negative if the downside dominates (previous day's low - day's low > day's high - previous day's high). If a day's price range is engulfed by the previous day's range, DI = 0. Technicians sometimes discard the sign and plot the absolue value together with other indicators.
Smoothing can be applied using e.g. ma or ema to get a longer term trend indicator. Alternatively, plot the difference +DI - -DI.
The charts below show the price of Cisco (NASD:CSCO) with the corresponding DI (in black) and 10 day EMA(DI) (in blue) from June 1 to December 31, 2001:

Note how quickly EMA(DI, 10) moves below 0 during downtrends in price and above 0 during uptrends in price. DM yields the same 0 crosses, but without the additional information provided by TR normalization.
Example
Assuming standard US date format settings,
=di({{"1/1/1990", 100, 90, 98}, {"1/2/1990", 97, 84, 86}})
returns {{32875, -0.461538461538462}}. 32875 is the date code for 1/2/1990; -0.46... is the DI value for that date.
See also asi, atr, dim, dip, dm, kb, rsi, si, tr, tsi, vhf, wad.