Investment Studio > Expressions > Functions > Indicator > MI

float array[*][2] mi(float array[*][3] dhl, integer sum_days = 25, integer ema_days = 9, float previous_ema_1 = 0, float previous_ema_2 = 0)

Returns a two-column array containing dates (first column) and corresponding Mass Index (MI) values (second column). Given n input rows in dhl, n - sum_days + 1 rows are returned.

dhl is a three-column array containing daily price range 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.

sum_days > 0 is the length of the time frame, i.e. the number of primary and secondary EMA output values contributing to the calculation of each day's MI value. If omitted, sum_days defaults to 25.

ema_days > 0 sets the time scale of the primary and secondary EMAs. If omitted, ema_days defaults to 9.

previous_ema_1 is the value of the primary EMA (applied to daily prices) on the trading day preceding the first date quoted in dhl. If omitted, previous_ema_1 defaults to 0.

previous_ema_2 is the value of the secondary EMA (applied to the output of the primary EMA) on the trading day preceding the first date quoted in dhl. If omitted, previous_ema_2 defaults to 0.

Interpretation

MI is a measure of volatility. Each trading day's price range (day's high - day's low) is passed through the primary EMA. The result is smoothed again by a secondary EMA of the same length (see the discussion of TRIX for details on the effect of multiple EMA smoothing). The MI is the sum of the ratios of the last sum_days primary and secondary EMA outputs. Like ATR, MI rises along with volatility; unlike ATR, MI is normalized (price is divided out of the ratio) so as to be more readily comparable across different time periods and across assets with different average prices.

According to the MI's inventor, Donald Dorsey, the most significant MI pattern is the "reversal bulge", characterized by the MI crossing above a threshold level and then falling below a lower trigger level. Reversal bulges are buy signals when prices are trending down, sell signals when prices are trending up. An EMA of daily prices with the same time scale as the MI EMAs (ema_days) is often used to determine the price trend.

With the default MI arguments, Dorsey recommended using 27.0 as the threshold level and 26.6 as the trigger level. In practice, these levels should be chosen based on the past history of the asset under study.

Volatility often tends to rise when prices are declining (a sign of increasing nervousness), peaking at major market bottoms; it tends to fall as prices climb steadily in mature bull markets (a sign of complacency, "good times are here to stay") but can rise sharply as major market tops break down. When this pattern is playing out, Dorsey's reversal bulges will catch the bottoms but miss the tops. The latter will instead be associated with inverted reversal bulges, i.e. with the MI crossing below a threshold level and then rising back up over a higher trigger level.

For a real life example, consider IBM (NYSE:IBM) from January 1 to December 31, 2001:

The top chart shows daily prices in standard candlestick form and their EMA(9). The bottom chart shows the MI with default arguments. Note how the second chart spends much of its time looking like the first one turned upside down: here, with the notable exception of July, volatility is indeed declining with rising prices and vice versa. Note also that Dorsey's recommended threshold level for reversal bulges would have left us without a single signal, in spite of all the action contained in these charts.

In general, volatility should be viewed primarily as supporting rather than as conclusive evidence of new market developments.

Example

Assuming standard US date format settings,

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

returns {{32875, 8.62068965517241}}. 32785 is the date code for 1/2/1990; 8.62... is the 2 day MI on that date (given default EMA arguments).

See also atr, bol, di, dim, dip, kb, tr, voi.