Investment Studio > Expressions > Functions > Indicator > DM

float array[*][2] dm(float array[*][3] dhl)

Returns a two-column array containing dates (first column) and corresponding Directional Movement (DM) values (second column). Given n input rows in dhl, n - 1 rows are returned.

dhl is a three-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).

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

DM 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.

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, DM = 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.

The charts below show the price of Cisco (NASD:CSCO) with the corresponding DM (in black) and 10 day EMA(DM) (in blue) from June 1 to December 31, 2001:

Note how quickly EMA(DM, 10) moves below 0 during downtrends in price and above 0 during uptrends in price. DI yields the same 0 crosses, but with additional information provided by TR normalization.

Example

Assuming standard US date format settings,

=dm({{"1/1/1990", 100, 90}, {"1/2/1990", 97, 84}})

returns {{32875, -6}}. 32875 is the date code for 1/2/1990; -6 is the DM value for that date, since the downside 90 - 84 = 6 is larger than the upside 100 - 97 = 3.

See also asi, atr, di, dim, dip, kb, si, tr, wad.