Conference PaperPDF Available

Optimization and Testing of Money Flow Index

Authors:

Abstract and Figures

The paper deals with whether the Money Flow Index (MFI) can still be used successfully for trading, and whether the parameters recommended in the literature are the best that an investor can use. Simulations in randomized time interval for the largest companies in the S&P 500 Index show that trading strategy based on MFI may be more profitable than a simple buy-and-hold strategy; however, parameters of MFI need to be optimized because those recommended in the literature do not produce the best results.
Content may be subject to copyright.
OPTIMIZATION AND TESTING OF MONEY FLOW INDEX
MAREK Patrice (CZ), ČADKOVÁ Věra (CZ)
Abstract. The paper deals with whether the Money Flow Index (MFI) can still be used
successfully for trading, and whether the parameters recommended in the literature are
the best that an investor can use. Simulations in randomized time interval for the largest
companies in the S&P 500 Index show that trading strategy based on MFI may be more
profitable than a simple buy-and-hold strategy; however, parameters of MFI need to be
optimized because those recommended in the literature do not produce the best results.
Keywords: Money Flow Index, MFI, S&P 500, buy-and-hold, stocks, investment,
trading
Mathematics Subject Classification: Primary 91G10; Secondary 62P20
1 Introduction
Money Flow Index (MFI) is an oscillator introduced to improve the Relative Strength Index
(RSI) published by Wilder (1978). Authors of MFI, Quong and Soudack (1989), state that MFI
measures the strength of money entering and leaving the market. This is according to the
authors achieved by taking volume into account, as volume can vary widely in market tops
and bottoms. They also suggest using more information about the price; therefore, the MFI uses
not only the close price but also high and low prices.
The computation of MFI requires to compute typical price () and money flow () for each
trading day. The typical price is defined as the average of adjusted high (), adjusted low (),
and adjusted close () price, i.e.

(1)
We recommend the use of adjusted prices as a decline caused by a dividend payment or a stock
split causes false movement in the stock price. This requirement is not usually found in the
literature, but we consider it important. The adjusted price (for dividends and splits) is explained
in the section Data.
770
The money flow is computed using the typical price and volume () as

(2)
The positive money flow (
) over a period of length is calculated as the sum of money
flows on the days when the typical price was higher than the typical price of the previous day
(i.e. when ). This can be explained by the formula
  

(3)
The negative money flow () over a period of length is calculated as the sum of money
flows on days when the typical price was lower than the typical price of the previous day
(i.e. when ). This can be explained by the formula
  

(4)
The money flow index is calculated as
 



(5)
Equation (5) reveals the meaning of MFI: It is the percentage of the positive money flow to the
total money flow over a given period. The standard length of period is 14 days. This parameter
will be optimised later in this paper.
Several different approaches can be used to obtain buy or sell signals. All of them use value
(  ) of MFI to indicate that stock is oversold and value  to indicate that stock
is overbought. The standard value of is 20, see e.g. Thomsett (2019, pp. 215217). Quong
and Soudack (1989) also used    to indicate truly oversold and truly overbought stock.
This parameter will also be optimized in this paper. We will adopt the same logic for signals as
Marek and Šedivá (2017) used for RSI, i.e.:
Buy signal occurs when the MFI returns to the value from below.
Sell signal occurs when the MFI returns to the value  from above.
Other trading techniques are:
Buy/sell signal occurs when the MFI enters the oversold or overbought zone, see
Thomsett (2018, pp. 180) for more details.
Identifying divergence between the MFI and price, see Thomsett (2019, pp. 215217)
for more details.
Marek and Šedivá (2017) studied RSI and used day-to-day optimization of its parameters. One
of the main findings of their paper is that the day-to-day optimization is not recommended as it
usually yields worse result than the RSI with the standard parameters. We will build on their
findings and instead of the day-to-day optimization we will focus of finding the best
combination of parameters and .
771
We will compare optimised MFI with:
MFI using standard parameters, i.e.    and   .
MFI using parameters set to indicate truly oversold and overbought stock, i.e.   
and   .
Simple buy-and-hold strategy.
The main goals of this paper are: to study whether the MFI, more than 30 years after its
publication, yields better results than a simple buy-and-hold strategy, and whether different
and settings can lead to a higher capital appreciation.
2 Data
The first step is to select the companies to be involved in the study. As stated in Marek and
Šedivá (2017), this is a key part of the research and must be carried out if possible without
any information available after the start of simulation, e.g., it is necessary to avoid conscious
inclusion or exclusion of companies that performed well or badly after the start of simulation.
We will use the same 16 companies as in Marek and Šedivá (2017) because we want to meet
similar requirements.
Our simulations start randomly between January 2, 2007 and December 31, 2009 (the interval
selection is explained in the section Methods); the choice must therefore respect that only
information of that period or some previous is used. We identified the largest companies of that
time as those involved in the top 10 companies with the highest weight in the S&P 500 Index.
The composition of the index for each year was obtained from ETF Database (2019). The first
involved companies are those that were involved among the top 10 companies with the highest
weight in the S&P 500 Index for the year 2006, i.e. before the start of all simulations. Next,
companies involved in the years 20072009 are also used. Tab. 1 lists all selected companies,
their ticker, and the first year (20062009) when they appeared in the top 10 companies with
the highest weight in the index.
Company
Ticker
Year
American International Group, Inc.
AIG
2006
Apple Inc.
AAPL
2009
AT&T Inc.
T
2007
Bank of America Corporation
BAC
2006
Chevron Corporation
CVX
2007
Citigroup Inc.
C
2006
Exxon Mobil Corporation
XOM
2006
General Electric Company
GE
2006
Google Inc. (now Alphabet Inc.)
GOOG
2007
International Business Machines Corporation
IBM
2009
Johnson & Johnson
JNJ
2006
JPMorgan Chase & Co.
JPM
2008
Microsoft Corporation
MSFT
2006
Pfizer Inc.
PFE
2006
The Procter & Gamble Company
PG
2006
Walmart Inc.
WMT
2006
Tab. 1. List of companies used in the simulations.
772
Historical records of high (), low (), close (), and adjusted close (
) prices were
obtained from the website Yahoo! Finance (2019). The adjusted close price contains
information about dividends (it is assumed that whenever an investor is entitled to a dividend,
he reinvests it immediately in the same stock) and splits, therefore we use this price in our paper
rather than the close price. We also use the adjusted close price to obtain the multiplier used
in its calculation ( 
) and calculate adjusted high price
  and adjusted
low price
  .
We obtained records between June 30, 2006 and July 31, 2019 for each stock listed in Tab. 1.
The period before the first investment date is necessary for the calculation of the MFI initial
value as at January 2, 2007.
3 Methods
First, we need to determine the starting date of simulation. Again, it has to be selected so that
it does not significantly affect the results. This is the main reason for deciding to use an interval
instead of one particular date. Each simulation starts randomly in a three-year window. This
window is set up to include dates before and after the peak of the financial crisis in 2008. Each
simulation starts between January 2, 2007 and December 31, 2009.
The same logic is used in the determination of the end of each simulation, and instead of a single
date we use a randomly selected date from the window between January 2, 2015 and
July 31, 2019. This means that each simulation lasts a minimum of five years and a maximum
of 12 and a half years.
The interval obtained according to the previous two paragraphs is used for each simulation
round where we calculate annual appreciation of the buy-and-hold strategy, strategies based on
the MFI with standard setting, i.e.   and   , and the MFI with setting set to indicate
truly oversold and overbought stock, i.e.    and   . Furthermore, MFI with each
remaining combination of    and    is used to calculate annual
appreciation. The lowest value of is set to cover at least one trading week as lower values can
be considered insufficient and the MFI would be highly unstable. The highest value of is
slightly higher than twice the standard setting and covers approximately period of one and half
month (30 trading days). Longer periods can cause the MFI to become too stable to generate
any trading signal (as confirmed by simulations).
Signal lines at 10 and 90 ( ) are commonly considered very strict (and produce a small
amount of signals), therefore we use this setting as one limit. The second limit is the signal lines
at 35 and 65 (  ), which usually produces large number of signals for MFI, and we can
expect many to be false.
The algorithm can be summarized as:
1. Randomly generate a simulation start date between January 2, 2007 and December 31,
2009.
2. Randomly generate a simulation end date between January 2, 2015 and July 31, 2019.
3. Calculate the corresponding annual appreciation for an investor using the buy-and-hold
strategy.
4. Calculate the corresponding annual appreciation for an investor using strategy based on
MFI with all selected combinations of and .
773
Simulation produces 677 results one for buy-and-hold strategy and 676 results for the MFI
(26 values of multiplied by 26 values of ). The simulation is repeated 1 000 times (each
round with a newly generated start and end of the simulation) for each company, producing
677 000 annual appreciations for each company. 1 000 simulations are enough to produce stable
results as shown in Fig. 1 and Fig. 2 for Apple. Both figures demonstrate that the average annual
appreciation is stable after approximately 100 simulations. Fig. 1 demonstrates stabilization for
MFI with standard parameters  and   , and Fig. 2 for MFI with extreme
combination of parameters    and   , i.e. situation where almost no trades were made
(for    and    we obtained no trade in every simulation). Similar behaviour
of stabilization was recorded for each company.
Fig. 1. Minimum, maximum and average annual appreciation for MFI strategy
with    and    in dependence on number of simulations for Apple.
Fig. 2. Minimum, maximum and average annual appreciation for MFI strategy
with    and    in dependence on number of simulations for Apple.
0%
1%
2%
3%
4%
5%
6%
7%
8%
9%
0
50
100
150
200
250
300
350
400
450
500
550
600
650
700
750
800
850
900
950
1000
Annual appreciation
Number of simulations
Min/Max Avg
0%
5%
10%
15%
20%
25%
30%
35%
40%
0
50
100
150
200
250
300
350
400
450
500
550
600
650
700
750
800
850
900
950
1000
Annual appreciation
Number of simulations
Min/Max Avg
774
The strategy that produces the highest annual capital appreciation is found in each simulation
round. This is used to compare strategies, as well as some basic statistical characteristics that
are obtained later. For the purpose of presenting the results we recognize:
buy-and-hold strategy (B&H),
MFI strategy with standard values of parameters    and    (denoted as
MFI(S)),
MFI strategy with parameters set to indicate truly oversold and overbought stock
   and    (denoted as MFI(TO)), and
the rest of MFI strategies are considered as one group denoted as MFI(oth.).
We also performed the same type of simulations in a shorter time interval to see how the
selected time window for trading affects the results. The start date was selected between
January 3, 2012 and July 1, 2014, and the end date was selected between January 3, 2017 and
July 31, 2019. For the simulations we used the same companies as before. It should be noted
that this means that we are no longer dealing with the largest companies of the S&P 500 Index
(although some companies were still part of the top 10 companies with the highest weight in
the S&P 500 Index), and that the peak of the financial crisis was several years before the interval
used to generate the start date.
4 Results
In each of the 1 000 simulations we found the strategy that produced the highest annual
appreciation. For the longer time interval (the earliest start date on January 2, 2007 and the
latest end date on July 31, 2019) we present results in Tab. 2. As can be seen, the highest annual
appreciation was usually achieved by MFI with parameter settings other than those
recommended in the literature.
Company
Ticker
B&H
MFI(S)
MFI(TO)
MFI(oth.)
AIG
AIG
6
0
0
994
Apple
AAPL
460
0
0
540
AT&T
T
37
0
0
963
Bank of America
BAC
38
0
0
962
Chevron
CVX
0
0
0
1000
Citigroup.
C
0
0
0
1000
Exxon Mobil
XOM
0
0
0
1000
General Electric
GE
11
0
0
989
Google (Alphabet)
GOOG
285
0
0
715
IBM
IBM
0
0
0
1000
Johnson & Johnson
JNJ
291
0
0
709
JPMorgan Chase
JPM
78
0
0
922
Microsoft
MSFT
243
0
0
757
Pfizer
PFE
265
0
0
735
Procter & Gamble
PG
279
0
0
721
Walmart
WMT
1
0
0
999
Tab. 2. Number of simulations where strategies recorded the highest annual
appreciation in the longer time interval, i.e. the earliest start date
on January 2, 2007 and the latest end date on July 31, 2019.
775
For the shorter time interval (the earliest start date on January 3, 2012 and the latest end date
on July 31, 2019) we present results in Tab. 3. Again, the highest annual appreciation was
usually achieved by MFI with parameter settings other than those recommended in the
literature.
Company
Ticker
B&H
MFI(S)
MFI(TO)
MFI(oth.)
AIG
AIG
87
0
0
913
Apple
AAPL
345
0
0
655
AT&T
T
3
17
0
980
Bank of America
BAC
158
0
0
842
Chevron
CVX
0
0
0
1000
Citigroup.
C
0
0
0
1000
Exxon Mobil
XOM
0
0
0
1000
General Electric
GE
0
0
0
1000
Google (Alphabet)
GOOG
34
0
0
966
IBM
IBM
0
0
0
1000
Johnson & Johnson
JNJ
367
0
0
633
JPMorgan Chase
JPM
512
0
0
488
Microsoft
MSFT
911
0
0
89
Pfizer
PFE
73
0
0
927
Procter & Gamble
PG
11
0
0
989
Walmart
WMT
0
0
0
1000
Tab. 3. Number of simulations where strategies recorded the highest annual
appreciation in the shorter time interval, i.e. the earliest start date
on January 3, 2012 and the latest end date on July 31, 2019.
As results presented in Tab. 2 and Tab. 3 indicate, the best results are usually achieved by MFI
with other than recommended settings. To determine for which combination of parameters
and we observed the highest annual appreciation we use a heat map. A demonstration for
Apple in the longer time interval (the earliest start date on January 2, 2007 and the latest end
date on July 31, 2019) is shown in Fig. 3. Each value represents the average annual appreciation
for MFI with given values of and . The highest average appreciation (20.3 % p. a.), was
achieved by MFI with    and   . The combination that achieved the highest average
annual appreciation was found for each company and the results are shown in Fig. 4 and Fig. 5.
The heatmap in Fig. 3 also reveals how stable the results are. Changes in does not affect the
results as much as the change in . This was generally observed in the other obtained heatmaps
and, also with regard to the definition of the MFI, it is an expected result. The results indicate
that some “areas” show a higher average annual appreciation, while other “areas” show a lower
appreciation. This was again observed for other companies. Finally, the heatmap demonstrates
that low values of may end in situation where no trade is made the “area” of zeros in the
lower left corner, and this “area” is adjacent to the area with high appreciation that is similar
to buy-and-hold strategy as only several (or one) trade is made for a given combination of
parameters.
776
Fig. 3. Average annual percentage appreciation for MFI with each parameter
combination for Apple in the longer time interval, i.e. the earliest start date
on January 2, 2007 and the latest end date on July 31, 2019.
Fig. 4 and 5 contain boxplots of simulations for the buy-and-hold strategy, MFI with standard
parameters (   and   ), MFI with parameters set to indicate truly
oversold/overbought stock (   and   ), and MFI that achieved the highest annual
appreciation (the second boxplot for each stock, the first parameter is and the second
parameter is ). MFI with optimum parameters usually has a higher annual appreciation than
the buy-and-hold strategy. Nevertheless, there is no clear answer as to what parameter settings
should be used in general, as results vary for each company and even for the longer and shorter
time interval. A stronger conclusion can be made regarding the values of the parameters
recommended in the literature (     , and   ,   ), because the results
showed that a strategy based on them usually achieved the average annual appreciation lower
than the simple buy-and-hold strategy, i.e. there is no special reason to use them.
777
Fig. 4. Boxplots of the average annual appreciation for the buy-and-hold strategy, MFI with
the highest annual appreciation, MFI with the standard parameters and MFI with the
parameters set to indicate truly oversold/overbought stock (the longer time interval,
i.e. the earliest start date on January 2, 2007 and the latest end date on July 31, 2019).
778
Fig. 5. Boxplots of the average annual appreciation for the buy-and-hold strategy, MFI with
the highest annual appreciation, MFI with the standard parameters and MFI with the
parameters set to indicate truly oversold/overbought stock (shorter time interval,
i.e. the earliest start date on January 3, 2012 and the latest end date on July 31, 2019).
779
5 Discussion
Tab. 2 and Tab. 3 show that strategy based on MFI can yield higher annual appreciation than
the buy-and-hold strategy; therefore, the use of the strategy based on MFI may be beneficial.
This is in contrast to the results shown by Marek and Šedivá (2017) who showed that in most
cases the buy-and-hold strategy yielded better results than a strategy based on optimized RSI
or RSI with recommended parameters. Their results are not directly comparable to the results
presented in this paper because they used day-to-day optimization of RSI; however, it suggests
that MFI produces better results than RSI. This can be expected because MFI contains not only
information about the close price but also about the high and low prices of the day and volume.
To summarize this, the first question of this paper whether the MFI, more than 30 years after
its publication, can yield better results in the competition to the simple buy-and-hold strategy
can be answered rather positively.
The second question whether a different setting of parameters and can lead to a higher
capital appreciation can also be answered positively. Tab. 2 and Tab. 3 showed that the two
recommended MFI settings in the literature (     , and   , ) are
overcome in all cases by other settings of parameters and . The only exception was recorded
in shorter time interval for AT&T where MFI with standard parameters (  
  ) achieved the best results in 17 (out of 1 000) simulations.
Based on the results presented in Fig. 4 and 5, we are unable to recommend one specific setting
of parameters because we obtained different optimal settings for each company and each time
interval. The recommendation is to optimize parameters for each company on historical data
and use these optimized settings. As indicated in Fig. 3, small parameter changes do not cause
radical change in the annual appreciation and the results can be considered robust. However,
robustness was not an analysed issue in this paper and it would be necessary to analyse how
often the parameters should be optimized and how this affects the profitability of a strategy
based on MFI.
It should be also noted that several indicators are usually used to create automated trading
system. MFI and RSI are very popular oscillators and based on our results and the results
presented in Marek and Šedivá (2017) we recommend using MFI rather than RSI.
6 Conclusion
This paper studied Money Flow Index (MFI) and how different settings, other than those
recommended in the literature, can affect the annual appreciation. For the comparison, we
performed simulations in the randomized time interval with the start date of each simulation
round generated between January 2, 2007 and December 31, 2009, and the end date generated
between January 2, 2015 and July 31, 2019. This ensures that results are not affected by one
particular time interval selection. All simulations were performed for the largest companies in
the S&P 500 Index in 20062009. All results were also compared to the simple buy-and-hold
strategy.
The results showed, that strategies based on MFI with the two recommended MFI settings in
the literature (     , and , ) were overcome by other settings of its
parameters. We could not, however, set specific settings for these parameters, or some subset
of settings, that could be generally recommended. The conclusion is that the parameters
recommended in the literature are currently of no significant importance (because they do not
780
offer any additional advantage in trading) and that one should optimize the parameters for each
stock before the start of trading.
The positive conclusion was that strategy based on MFI can overcome the simple buy-and-hold
strategy for many stocks studied in this paper, and that it can offer an additional advantage to
the trading.
To confirm the results of the paper, we performed simulations in the shorter time interval. The
findings were the same, i.e., MFI with some parameters can be used to achieve higher
appreciation than the buy-and-hold strategy, and it is not possible to recommend one specific
and setting for all stocks in general.
Acknowledgement
The first author of this publication was supported by the project LO1506 of the Czech Ministry
of Education, Youth and Sports.
References
[1] THOMSETT, M. C., Candlestick Charting Profiting from Effective Stock Chart Analysis.
Boston/Berlin: Walter de Gruyter Inc., 2018.
[2] THOMSETT, M. C., Practical Trend Analysis Applying Signals and Indicators to
Improve Trade Timing. Boston/Berlin: Walter de Gruyter Inc., 2019.
[3] MAREK, P., ŠEDIVÁ, B, Optimization and Testing of RSI. In Proceedings of 11th
International Scientific Conference on Financial Management of Firms and Financial
Institutions, Ostrava, 2017, ISBN 978-80-248-4139-7, pp. 530537.
[4] QUONG, G., SOUDACK, A., Volume-weighted RSI: money flow. Technical Analysis of
STOCKS & COMMODITIES 7(3), 1989: pp. 7677.
[5] WILDER, W. J., New Concepts in Technical Trading Systems. Greensboro: Trend
Research, 1978.
[6] ETF DATABASE. Visual History Of The S&P 500 [online]. Chicago: ETF Database, 2019
[accessed 2019-08-15]. Retrieved from: http://etfdb.com/history-of-the-s-and-p-500/.
[7] YAHOO! FINANCE [online]. [ACCESSED 2019-08-15]. Retrieved from:
https://finance.yahoo.com/.
Current address
Marek Patrice, Ing., Ph.D.
European Centre of Excellence NTIS New Technologies for Information Society
Faculty of Applied Sciences
University of West Bohemia
Univerzitní 8, 301 00 Plzeň, Czech Republic
E-mail: patrke@kma.zcu.cz
Čadková Věra, Ing.
Regional Technological Institute
Faculty of Mechanical Engineering
University of West Bohemia
Univerzitní 8, 301 00 Plzeň, Czech Republic
E-mail: cadkovav@rti.zcu.cz
781
Article
Full-text available
A highly transmittable and pathogenic viral infection, COVID-19, has dramatically changed the world with a tragically large number of human lives being lost. The epidemic has created psychological resilience and unbearable psychological pressure among patients and health professionals. The objective of this study is to analyze investor psychology and stock market behavior during COVID-19. The psychological behavior of investors, whether positive or negative, toward the stock market can change the picture of the economy. This research explores Shanghai, Nikkei 225, and Dow Jones stock markets from January 20, 2020, to April 27, 2020, by employing principal component analysis. The results showed that investor psychology was negatively related to three selected stock markets under psychological resilience and pandemic pressure. The negative emotions and pessimism urge investors to cease financial investment in the stock market, and consequently, the stock market returns decreased. In a deadly pandemic, the masses were more concerned about their lives and livelihood and less about wealth and leisure. This research contributes to the literature gap of investors’ psychological behavior during a pandemic outbreak. The study suggests that policy-makers should design a plan to fight against COVID-19. The government should manage the health sector’s budget to overcome future crises.
Conference Paper
Full-text available
This paper deals with the Relative Strength Index (RSI), a popular oscillator. It answers the question whether-almost 40 years after its publication-the RSI can be still useful in trading. To answer this question, we compare four strategies: RSI with recommended parameters, RSI that uses parameters optimized each trading day, simple buy-and-hold strategy, and strategy based on Kelly gambling. Companies that were included with the largest weights in the S&P 500 Index in years 2006-2009 are used for simulations. Totally, 10,000 simulations of investment are performed for each strategy. Start of each simulation is randomly chosen between 15 February 2007 and 12 February 2010. The end is randomly chosen between 18 February 2014 and 14 February 2017. Companies and dates are used so they include as little information that we possess nowadays as possible. Later, simulations with shorter time interval are performed to verify findings.
Book
Investors and traders seek methods to identify reversal and continuation to better time their trades. This applies for virtually everyone, whether employing a swing trading strategy, engaging in options trading, or timing entry and exit to spot bull and bear reversals. Key signals are found in the dozens of candlesticks, combined with technical signals such as gaps and moves outside of the trading range; size of wicks (shadows) and size of real bodies. The science of candlestick analysis has a proven track record not only from its inception in 17th century Japan, but today as well. This book explains and demonstrates candlestick signals, including both the appearance of each but in context on an actual stock chart. It further takes the reader through the rationale of reversal and continuation signals and demonstrates the crucial importance of confirmation (in the form of other candlesticks, traditional technical signals, volume, momentum and moving averages).
Volume-weighted RSI: money flow
  • G Quong
  • A Soudack
QUONG, G., SOUDACK, A., Volume-weighted RSI: money flow. Technical Analysis of STOCKS & COMMODITIES 7(3), 1989: pp. 76-77.
Visual History Of The S&P 500
  • Etf Database
ETF DATABASE. Visual History Of The S&P 500 [online]. Chicago: ETF Database, 2019 [accessed 2019-08-15]. Retrieved from: http://etfdb.com/history-of-the-s-and-p-500/.