# Money Flow Index

This study calculates and displays a Money Flow Index (MFI) for the Price Data. The MFI is a momentum indicator that measures the strength of money flowing in and out of a security. It is related to the relative Strength Index (RSI), but whereas the RSI incorporates only prices, the MFI accounts for volume.

The MFI makes use of the notion of a Typical Price. We denote the Typical Price at Index $$t$$ as $$P^{(Typ)}_t$$, and we take this to be the average of the High $$H$$, Low $$L$$, and Close $$C$$ Prices at Index $$t$$. We state this symbolically as follows.

$$\displaystyle{P^{(Typ)}_t = \frac{H_t + L_t + C_t}{3}}$$

Let $$V_t$$ denote the Volume at Index $$t$$. We denote the Raw Money Flow, Positive Money Flow, and Negative Money Flow at Index $$t$$ as $$RMF_t$$, $$MF^{(+)}_t$$, and $$MF^{(-)}_t$$, respectively, and we compute them as follows.

$$RMF_t = P^{(Typ)}_t \cdot V_t$$

$$MF^{(+)}_t = \left\{ \begin{matrix} RMF_t & P^{(Typ)}_t > P^{(Typ)}_{t - 1} \\ 0 & P^{(Typ)}_t \leq P^{(Typ)}_{t - 1} \end{matrix}\right .$$

$$MF^{(-)}_t = \left\{ \begin{matrix} RMF_t & P^{(Typ)}_t < P^{(Typ)}_{t - 1} \\ 0 & P^{(Typ)}_t \geq P^{(Typ)}_{t - 1} \end{matrix}\right .$$

Let $$n$$ denote the Length Input. Then we denote $$n$$-period Positive and Negative Money Flows as $$MF^{(+)}(n)_t$$, and $$MF^{(-)}(n)_t$$, respectively, and we compute them as follows.

$$\displaystyle{MF^{(+)}_t(n) = \sum_{i = t - n + 1}^t} MF^{(+)}_i$$

$$\displaystyle{MF^{(-)}_t(n) = \sum_{i = t - n + 1}^t} MF^{(-)}_i$$

We denote the Money Flow Ratio at Index $$t$$ as $$MFR_t(n)$$, and we compute it as follows.

$$\displaystyle{MFR_t(n) = \frac{MF^{(+)}_t(n)}{MF^{(-)}_t(n)}}$$

Finally, we denote the Money Flow Index at Index $$t$$ as $$MFI_t(n)$$, and we compute it as follows.

$$\displaystyle{MFI_t(n) = 100 - \frac{100}{1 + MFR_t(n)}}$$