Learn R Programming

TTR (version 0.23-4)

MFI: Money Flow Index

Description

The MFI is a ratio of positive and negative money flow over time.

Usage

MFI(HLC, volume, n = 14)

Arguments

HLC

Object that is coercible to xts or matrix and contains High-Low-Close prices. If only a univariate series is given, it will be used. See details.

volume

Vector or matrix of volume observations corresponding to HLC object.

n

Number of periods to use.

Value

A object of the same class as HLC and volume or a vector (if try.xts fails) containing the MFI values.

Details

Money Flow (MF) is the product of price and volume. Positive/negative MF occur when today's price is higher/lower than yesterday's price. The MFI is calculated by dividing positive MF by negative MF for the past n periods. It is then scaled between 0 and 100.

MFI is usually calculated using the typical price, but if a univariate series (e.g. Close, Weighted Close, Median Price, etc.) is provided, it will be used instead.

References

The following site(s) were used to code/document this indicator: http://www.fmlabs.com/reference/default.htm?url=MoneyFlowIndex.htm https://www.linnsoft.com/techind/money-flow-index-mfi http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:money_flow_index_mfi

See Also

See OBV and CMF.

Examples

Run this code
# NOT RUN {
data(ttrc)
mfi <- MFI(ttrc[,c("High","Low","Close")], ttrc[,"Volume"])

# }

Run the code above in your browser using DataLab