Introduction to MFI and Its Practical Use in Quantitative Trading

2021-10-15, 07:11

Both trend indicators (e.g. MA, KDJ) and momentum indicators (e.g.ROC, WILLR) can be calculated only by the price. However, it doesn’t adequately reflect all the information about the market in cryptocurrency trading. Data such as trading volume, number of trades and long-short ratio also contain a lot of market information that can’t be extracted by using indicators that only consider price. If investors rely only on these indicators to analyze markets, there is a risk that they will not be able to obtain comprehensive market information. In order to make full use of market data, quantitative investment researchers have developed some indicators that contain data other than price. MFI, short for the Money Flow Index, is an indicator that incorporates price and volume data to analyze markets that reflect price changes after the transaction volume adjustment.


What is MFI used for?

Similar to the RSI in terms of functions, the MFI is also a tool used in technical analysis to measure the pressure of buying/selling cryptocurrencies. The MFI value is calculated by price and transaction volume and can measure the flow of money in and out of any cryptocurrency. Its calculation generates a value that can be plotted as a line that moves within a range of 0-100. There are two classic approaches to use the MFI curve:


1. Directly read the MFI value: When its reading exceeds a given value “A”, it indicates that the market sees a buying top. And if the value continues to break above the “A”, it signals that there is sufficient buying power in the market and investors can try to enter. On the contrary, if the MFI value is lower than a given value “B”, the market sees prices moving to the downside. If the value continues to be below the “B”, it can be considered that the market's selling power is dominant and investors can go short.
2. Identify the possibility of a reversal in market conditions with the combination of indicators and price action. When the MFI index and the price trend show divergence, there can be a possible reversal in price movement.


How to calculate the Money Flow Index?

The MFI indicator is calculated in a similar manner to the RSI. It is to calculate the ratio of price change over a certain period, while the MFI is to measure the percentage of price change after the adjustment of transaction volume. There are four steps for calculating the Money Flow Index that can be seen as follows:


1. Calculate the Typical Price(TP) of a cryptocurrency during the trading period:
(High, Close and Low refer to the highest, closing and lowest prices for a given period. The Typical Price is a representation of the cryptocurrency's price during the period and can be considered as a price average.)

2. Calculate the Money Flow for a given trading period:

3. Judge the flow of money in the transaction period:
If the MF of the previous trading period is greater than the MF of the current period, it is judged as money outflow, and it’s considered PMF(Positive Money Flow); When the MF of the previous period is less, it is judged as money inflow, and it’s considered NMF(Negative Money Flow).

4. Calculate the Money Flow Ratio
Adding up all the positive money flow and dividing it by the negative money flow in the calculation periods.

5. Calculate the Money Flow Index (MFI)


Advantage of Using the MFI


Just like RSI, the MFI is also a key indicator for measuring investor sentiment and analyzing buying/selling pressure. But it incorporates volume, whereas the RSI only considers price. This prevents the problem that the RSI sometimes runs into by predicting pure price increases as market bullishness.


MFI Strategy Design

The MFI can be understood as an RSI indicator that considers volume data, and is also used as a tool to measure investors’ sentiment. When developing the strategy, the application of the MFI is similar to the RSI. Not only can traders utilize the MFI index alone to judge the power of the long/short positions, but it can also establish a composite indicator strategy in conjunction with other indicators.

There is a classic method of strategy design when creating a strategy with the MFI alone. The MFI is utilized to spot the moment when a crypto coin enters an extremely strong long position so the investor can buy. The moment a cryptocurrency enters an extremely strong short position, it’s time for the investor to sell. The criteria is as follows: When the MFI value is consistently greater than a certain value, the market is considered to be over leveraged to the buy side; When the MFI value is consistently lower than a certain value, the market is considered to be over leveraged to the short side. In the stock market, the MFI values used to determine the overbought and oversold conditions are usually 80 and 20 over a 14-day period. In other words, an MFI reading consistently above 80 is considered overbought in stocks and prices will rise further, while an MFI reading consistently below 20 is considered oversold and prices will see continuous decline. In the case of cryptocurrency investments, there are fewer scenarios where the MFI value is above 80 or below 20, and when designing a strategy, the threshold needs to be adjusted for different coins.

The MFI can also be used in conjunction with other indicators. The most common among them are the MACD and the MA. When creating a MACD-MFI or MA-MFI strategy, the MACD and MA are usually used to determine the price trend, while the MFI is used to confirm the exact entry and exit points within the trend.

Examples of How to Use the MFI
MACD—MFI Strategy
[Trading Coins]
BTC: The main coin used in the strategy research
ETH: The coin used to test the generalization ability of the strategy
[Trading Period]
1 Hour
[Leverage]
None
[Backtesting Time]
BTC Time:01/01/2021 to 23/09/2021
ETH Time:01/01/2021 to 23/09/2021
[Trading Logic]
The MACD is utilized to determine the price movement, and the MFI is used to identify the optimal entry and exit time within a trend. If a DIF value above the DEA signals an uptrend in cryptocurrency price and the MFI reading is above the set value, it will be a buy signal; When price sees a downtrend and the MFI is less than the set value, it will be a sell signal.
[Parameter Settings]
This strategy involves three parameters; The fast EMA, slow EMA and the MACD signal. In order to reduce the model parameters, the period parameter of the MFI is set to be the same as the fast EMA used with the MACD indicator.
Fast EMA: 12
Slow EMA: 24
MACD Signal: 9
[Set Stop-loss ratio]
Auto Stop-Loss Ratio: 2%

[Backtest Results]
For BTC:





As can be seen, the strategy can achieve a cumulative return of 50.68% on BTC under unleveraged conditions, with a max drawdown below of 10%.

For ETH:
The strategy works great after its application on ETH, even without any parameter optimization.


Share
gate logo
Credit Ranking
Complete Gate Post tasks to upgrade your rank