ta.mfi
Gauge buying and selling pressure from price and volume on a 0 to 100 scale.
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.
| Name | Kind | Type | Unit | Default | Range | Description |
|---|---|---|---|---|---|---|
source | Series | number | - | - | - | Typically hlc3. |
length | Constant | number | - | 14 | 1 to 10000 | Window in observed bars. |
bars | Constant | bars | bars | na | - | Which bars to read: a declared series, or na for the chart's own. |
Output
| Name | Type | Unit |
|---|---|---|
value | number | - |
Warm-up and missing values
- Warm-up
length + 1bars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
lengthconsecutive 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
ta.mfi(hlc3, 14)plot(ta.mfi(hlc3, 14), "Money flow 14")