Docs

ta.mfi

Gauge buying and selling pressure from price and volume on a 0 to 100 scale.

itm
ta.mfi(source, length, bars)

Money Flow Index: 100 - 100 / (1 + positive / negative). Positive sums source*volume over the window on the bars where the source rose, and negative sums it on the bars where it fell, with volume read from bars. These are plain rolling sums, not Wilder smoothing, which is the difference from ta.rsi.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeUnitDefaultRangeDescription
sourceSeriesnumber---Typically hlc3.
lengthConstantnumber-141 to 10000Window in observed bars.
barsConstantbarsbarsna-Which bars to read: a declared series, or na for the chart's own.

Output

NameTypeUnit
valuenumber-

Warm-up and missing values

Warm-up
length + 1 bars. Names in the warm-up are this operator’s parameters.
Missing values
Returns na until length consecutive bars with both a source change and a volume have been observed (so length + 1 bars in all). An na in either resets the accumulation. Returns 100 when the window has no negative money flow at all.

Example

itm
ta.mfi(hlc3, 14)
itm
plot(ta.mfi(hlc3, 14), "Money flow 14")