MoneyFlowIndex
MoneyFlowIndex in ProBuilder returns the volume-weighted RSI, a 0 to 100 oscillator of buying and selling pressure. Syntax, formula and worked examples.
Syntax
MoneyFlowIndex[N]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
N | integer | none | Lookback period in bars over which positive and negative money flows are summed. The most common setting is 14. |
Formula
TypicalPrice = (high + low + close) / 3
MoneyFlow = TypicalPrice * volume
MR = Sum of positive MoneyFlow over N bars / Sum of negative MoneyFlow over N bars
MFI = 100 - (100 / (1 + MR))A bar's money flow counts as positive when its typical price exceeds the previous bar's typical price, and negative when it is lower. The final step maps the ratio into the fixed 0 to 100 range.
How it works
The Money Flow Index applies the RSI transformation to volume-weighted price changes instead of raw price changes. Each bar's typical price is multiplied by its volume, producing a money flow figure that represents the value traded at that level. Bars where the typical price rose contribute to the positive pool, bars where it fell contribute to the negative pool.
Over the last N bars, the ratio of these two pools shows which side committed more traded value. The RSI-style formula then compresses that ratio into a bounded oscillator: heavy buying pushes the index toward 100, heavy selling toward 0.
The volume weighting is the practical difference from RSI. A large price move on thin volume moves the MFI far less than the same move on heavy volume, so MFI and RSI can disagree, and those disagreements are themselves used as signals about the conviction behind a move.
Examples
Example 1, Basic Money Flow Index plot (Indicator)
// 14-bar Money Flow Index with reference levels
mfiValue = MoneyFlowIndex[14]
RETURN mfiValue AS "MFI", 80 AS "Overbought", 20 AS "Oversold"Plots the standard 14-bar MFI together with horizontal lines at the conventional 80 and 20 thresholds.
Example 2, Oversold screener with volume confirmation (ProScreener)
// Oversold instruments that still trade meaningful volume
mfi = MoneyFlowIndex[14]
active = volume > average[20](volume)
SCREENER[mfi < 20 AND active](mfi AS "MFI 14")Returns instruments with an MFI below 20 where current volume exceeds its 20-bar average, filtering out illiquid names whose readings are less reliable.
Example 3, Mean reversion with an MFI trigger (ProBacktest)
// Buy oversold readings in an uptrend, exit when pressure normalises
trend = Average[200](close)
mfi = MoneyFlowIndex[14]
IF NOT OnMarket AND close > trend AND mfi < 20 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF LongOnMarket AND mfi > 60 THEN
SELL AT MARKET
ENDIFA pullback template. The 200-bar average restricts entries to uptrends, MFI below 20 marks the volume-confirmed washout, and the position exits once the index recovers past 60.
Interpretation
| Zone | Range | Reading |
|---|---|---|
| Oversold | MFI < 20 | Selling has dominated traded value. Often precedes a bounce, but can persist in downtrends. |
| Neutral | 20 to 80 | No extreme in volume-weighted pressure. |
| Overbought | MFI > 80 | Buying has dominated traded value. Can persist in strong uptrends. |
Divergences. Price making new highs while MFI makes lower highs suggests the advance is attracting less traded value, a warning sign. The bullish mirror applies at lows. As with all oscillators, divergence identifies weakening pressure, not timing.
Common errors and gotchas
- Wrong bracket type.
MoneyFlowIndex(14)fails to compile. The period goes in square brackets:MoneyFlowIndex[14]. The instruction takes no price argument, it always uses the typical price. - Volume required. On instruments without genuine volume data the index is not meaningful, even though the code runs without errors.
- Pinned at extremes on short windows. If every bar in the window moved the same direction, one flow pool is zero and the index pegs at 100 or 0. Very small
Nvalues make this common. - Not interchangeable with RSI. The two often diverge because MFI weights by volume. Thresholds and signal logic tuned on RSI should be revalidated before being applied to MFI.
Related instructions
RSI, the price-only oscillator this indicator extends with volume.MoneyFlow, a bounded -1 to 1 pressure gauge from the same family.OBV, cumulative signed volume, an unbounded alternative.Volume, the raw per-bar volume used in the money flow calculation.TypicalPrice, the (high + low + close) / 3 constant at the core of the formula.AccumDistr, accumulation and distribution line.ChaikinOsc, oscillator built on the accumulation and distribution line.Stochastic, another bounded oscillator with comparable threshold logic.
