Sidechair

ta.mfi()

Browse the reference

Returns the money flow index: a volume-weighted relative strength reading from 0 to 100 over length bars.

Try it in the editor

ta.mfi multiplies each bar's volume by series when series rose, and separately when it fell. It sums both over length bars and returns 100 - 100 / (1 + upSum / downSum).

Feed it hlc3 for the usual typical-price version. The first reading comes on bar number length.

Syntax

Pine Script
ta.mfi(series: series int/float, length: series int) -> series float

Arguments

NameTypeDefaultDescription
seriesseries int/floatrequiredPrice series whose direction decides the side of each bar's volume, usually hlc3.
lengthseries intrequiredNumber of bars in the sums. A whole number of 1 or more.

Returns

series float: a value from 0 to 100, or na while the window is not full.

Remarks

  • The result is na on symbols that report no volume.
  • Readings above 80 and below 20 are the usual extremes.

Example

Pine ScriptMoney flow index with levelsOpen in editor
//@version=6
indicator("MFI")
value = ta.mfi(hlc3, 14)
plot(value, "MFI", color = color.purple)
hline(80, color = color.red)
hline(20, color = color.green)

See also

Runs on Sidechair