ta.mfi() - Pine Script Function
ta.mfi()
Section titled “ta.mfi()”Overview
Section titled “Overview”Money Flow Index. The Money Flow Index (MFI) is a technical oscillator that uses price and volume for identifying overbought or oversold conditions in an asset.
Syntax
Section titled “Syntax”ta.mfi(series, length) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| series | series int/float | Series of values to process. |
Returns
Section titled “Returns”Money Flow Index.
Remarks
Section titled “Remarks”- na values in the source series are ignored; the function calculates on the length quantity of non-na values.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("Money Flow Index")plot(ta.mfi(hlc3, 14), color=color.yellow)// the same on pinepine_mfi(src, length) => float upper = math.sum(volume * (ta.change(src) <= 0.0 ? 0.0 : src), length)float lower = math.sum(volume * (ta.change(src) >= 0.0 ? 0.0 : src), length)mfi = 100.0 - (100.0 / (1.0 + upper / lower))mfiplot(pine_mfi(hlc3, 14))