Expand description
§Money Flow Index (MFI)
Volume-weighted RSI-style oscillator on typical price:
TP = (H + L + C) / 3
raw money flow = TP * volume
+MF / −MF over period by TP direction vs prior TP
MFI = 100 − 100 / (1 + +MF/−MF)Warm-up: needs period money-flow samples after the first bar (first TP has no prior).
First MFI at index period (period flows from bars 1..=period).
If −MF = 0 and +MF > 0 → MFI = 100; if both zero → None.
Default: period 14 (MfiParams::period_14).
§Trading perspective
| Region | Habit (classic) |
|---|---|
| MFI > 80 | “Overbought” with volume |
| MFI < 20 | “Oversold” with volume |
| Divergence vs price | Volume not confirming price extreme |
§vs RSI / OBV
| MFI | RSI | OBV | |
|---|---|---|---|
| Uses volume | Yes (× TP) | No | Yes (cumulative) |
| Bounded | 0–100 | 0–100 | Unbounded |
| Narrative | Money flow heat | Close momentum | Flow confirmation |
Prefer MFI when volume quality matters for OB/OS; RSI when volume is noisy or missing; OBV for cumulative divergence without bounds.
§Pairs well with
- Price oscillators (RSI/WillR) — agreement at extremes is stronger; disagreement is a flag.
- VWAP — intraday location vs session VWAP + MFI.
- ADX — high MFI in a strong ADX trend can stay elevated (trend, not auto-fade).
§Engineering
MfiParams → mfi / MfiState → mfi_solution. Batch via state.
After warm-up each push is O(1) via rings of +MF/−MF contributions.
Structs§
- MfiParams
- MfiSeries
- MfiSolution
- MfiState
- Incremental MFI.
- Validated
Mfi
Functions§
- mfi
- mfi_
solution - Examples