MoneyFlowIndex

Calculates the Money Flow Index indicator.

Accepts the following parameters:

Parameter NameTypeDefault ValueNotes
periodNumber14-

Returns: Series<Number>

MoneyFlowIndex is a built-in function - you can use it directly. Below is an example implementation:

1 function MoneyFlowIndex(period = 14):
2 positiveFlow = Sum(volume * typical if typical > typical[1] else 0, period)
3 negativeFlow = Sum(volume * typical if typical < typical[1] else 0, period)
4
5 unknown if (
6 not isknown typical[period]
7 ) else 100 if (
8 negativeFlow == 0
9 ) else 100 - 100 / (1 + positiveFlow / negativeFlow)