Investment Studio > Expressions > Functions > Indicator > MFM

float array[*][2] mfm(float array[*][5] dhlcv, integer days)

Returns a two-column array containing dates (first column) and corresponding negative Money Flow (MFM) 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.

days > 0 is the length of the time frame, i.e. the number of trading days contributing to the calculation of each day's MFM value.

Interpretation

MFM is a downside momentum indicator (and the negative component of MFI).

Every trading day, the so-called Typical Price (a simple arithmetic average of the day's high, low and close, also available as function TP)

    high + low + close
Typical Price  =  ¾¾¾¾¾¾¾¾
    3

is computed and compared with the previous trading day's Typical Price; if it has declined, the quantity

Money Flow = Typical Price * volume

is considered negative money flow. The sum of all such negative money flows over the last days is the day's MFM value. A rising MFM is assumed to imply a growing flow of money out of the asset under study, an obviously bearish sign.

Note that this is not a strict result. MFM and relatives (MFP, MFI) are 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.

MFM is usually plotted together with its upside counterpart, MFP. Signals are triggered by the MFM crossing above the MFP (sell) and by the MFP crossing above the MFM (buy).

For a real life example, consider Cisco (NASD:CSCO) from June 1 to December 31, 2001:

The top chart shows the price in standard candlestick form, with signals from MFM/MFP crossings highlighted in red (sell) and green (buy). The middle chart shows volume. The bottom chart shows the actual ten day MFM (red) and MFP (green) lines, with arrows marking the crossings.

Example

Assuming standard US date format settings,

=mfm({{"1/2/1990", 100, 90, 98, 1000}, {"1/1/1990", 97, 84, 86, 858}}, 1)

returns {{32875, 76362}}. 32875 is the date code for 1/2/1990; 76362 = 858 * (97 + 84 + 86) / 3 is the one day MFM on that date since 100 + 90 + 98 > 97 + 84 + 86.

The MFM/MFP chart above uses the definitions

_NDAYS = 10

_QUOTES = asset_quotes(SELF, "HLCV", FROM_DATE - 2 * _NDAYS, TO_DATE)

_MFM = mfm(array(_QUOTES), _NDAYS)

_MFP = mfp(array(_QUOTES), _NDAYS)

_CROSSES = crosses(array(_MFP), 2, array(_MFM), 2)

_MFMX = vlookup(array(_MFM), 2, FALSE) * 1E-6

_MFPX = vlookup(array(_MFP), 2, FALSE) * 1E-6

the line sources

_MFMX

_MFPX

and the image source

choose(2 + vlookup(X, array(_CROSSES), 2, FALSE), {9, _MFMX, -25}, "", {10, _MFMX, 25})

The highlighting in the top chart is done with the image source

choose(2 + vlookup(X, array(_CROSSES), 2, FALSE), {13, asset_close(SELF, X)}, "", {12, asset_close(SELF, X)})

See also acd, dip, efi, eom, mfi, mfp, obv.