Skip to content

Technical indicators

Money Flow Index (MFI)

The share of recent volume that went with rising bars, from 0 to 100.

Each bar’s money flow is its typical price, (high + low + close) / 3, times its volume. MFI is the share of the window’s money flow that came from up bars, scaled like RSI. A bar counts as up when its typical price is above the previous bar’s, and as down when it is below; an unchanged bar counts on neither side. Volume here is the volume the price feed reports for each bar. For forex, brokers usually report the number of price updates in the bar, not an amount traded, so read it as activity rather than money.

Traders read above 80 as overbought and below 20 as oversold, and the chart draws those lines.

typical price = (high + low + close) / 3
money flow = typical price × volume
positive flow = sum over the window of money flow on bars whose typical price rose
negative flow = sum over the window of money flow on bars whose typical price fell
MFI = 100 − 100 / (1 + positive flow / negative flow)

A window with only positive flow gives 100, and one with no flow at all gives 0.

Call: mfi(emaPeriods)

Setting Chart default
emaPeriods: Periods 14

What you get: a number.

Warm-up: with mfi(14), it asks for 0 bars of history and a run-up of 15, and its first value came on bar 15 of the example data.

Money Flow Index (MFI) drawn by its own code on example prices

The prices are made up, hourly, and the same on every page, so the chart shows how the indicator behaves, not how a market behaved.

function onIntervalClose() {
const value = mfi(14);
if (OPEN_POSITIONS_COUNT === 0 && value < 20) {
openPosition("BUY", { quantity: 10000, stopLossPips: 25, takeProfitPips: 40 });
}
}