mfi

Money Flow Index (Volume-weighted momentum oscillator)

mfi(period)

A volume-weighted momentum oscillator that measures buying and selling pressure. Often called "volume-weighted RSI" as it incorporates volume into the calculation.

Parameters

  • period (int): Number of periods for money flow calculation
  • Common values: 14 (standard), 10, 20

Formula


MFI = 100 - (100 / (1 + Money Flow Ratio))

Where:
- Money Flow Ratio = Positive Money Flow / Negative Money Flow
- Raw Money Flow = Typical Price * Volume
- Typical Price = (High + Low + Close) / 3
- Positive Flow = Money flow when typical price rises
- Negative Flow = Money flow when typical price falls

Examples


mfi(14);  # Standard 14-period MFI
mfi(10);  # More sensitive 10-period MFI
mfi(14) > 80;  # Overbought with volume confirmation
mfi(14) < 20;  # Oversold with volume confirmation

Returns

MFI value ranging from 0 to 100

Notes

  • Values > 80 indicate overbought with strong buying pressure
  • Values < 20 indicate oversold with strong selling pressure
  • More reliable than price-only oscillators due to volume weighting
  • Returns 100 when negative flow is 0, returns 0 when positive flow is 0