Investment Studio > Expressions > Functions > Indicator > MFI
float array[*][2] mfi(float array[*][5] dhlcv, integer days)
Returns a two-column array containing dates (first column) and corresponding Money Flow Index (MFI) values (second column). Given n input rows in dhlcv, n - days rows are returned.
dhlcv is a five-column array containing daily price and volume 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). |
| 5 | The day's volume (number of traded shares). |
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.
In the absence of high, low or volume data, consider using the related RSI instead.
days > 0 is the length of the time frame, i.e. the number of trading days contributing to the calculation of each day's MFI value.
Interpretation
MFI is a momentum indicator. It's essentially the ratio between positive and negative money flows (see MFP and MFM), i.e. a guesstimate of the relation between money flowing into and out of the asset under study, scaled so as to range from 0 to 100:
| 100 | ||
| MFI | = 100 - | ¾¾¾¾¾¾ |
| 1 + MFP / MFM |
MFI crossings of the 50 level are equivalent to crossings of the underlying MFP / MFM indicators, and can be used as equivalent buy and sell signals.
MFI values over 80 are usually considered a sign that the market is overbought; MFI values under 20 are considered a sign that the market is oversold. In both cases, the interpretation is that the current trend may be getting ahead of itself, setting up the stage for a reaction move.
Divergences between price and the MFI can also presage a trend reversal in price: prices trending higher while the MFI is declining suggest that a market top is near, and vice versa. Divergences are considered most significant when an overbought/oversold condition is in place.
Like the underlying MFP and MFM, the MFI is mainly useful in the absence of tick-by-tick data showing the price and number of shares traded in each transaction over the course of the trading day (and hence the actual net flow in the asset) or at least of actual upside/downside volume data.
For a real life example, consider Cisco(NASD:CSCO) from June 1, 2001 to December 31, 2001:

The top chart shows the price in standard candlestick form. Buy and sell signals triggered by the ten day MFI crossing the 50 level are marked in green (buy) and red (sell). The middle chart shows volume. The bottom chart shows the actual ten day MFI, with overbought (80), center (50) and oversold (20) levels marked in gray. Note that overbought and oversold conditions can be protracted and do not by themselves trigger buy and sell signals.
Example
Assuming standard US date format settings,
=mfi({{"1/1/1990", 97, 84, 86, 858}, {"1/2/1990", 100, 90, 98, 1000}}, 1)
returns {{32875, 100}}. 32875 is the date code for 1/2/1990; 100 is the one day MFI on that date, since the underlying one day MFM = 0: 100 / (1 + MFP / MFM) = 100 / (1 + ¥) = 0.