Interactive illustrations to Chapters 9 and 10 of the book

Market Timing with Moving Averages: The Anatomy and Performance of Trading Rulesby Valeriy Zakamulin

**Chapter 9** utilizes the longest historical sample of data on the S&P Composite stock index and comprehensively evaluates the profitability of various moving average trading rules. Among other things, the chapter investigates the following: which trading rules performed best; whether the choice of moving average influences the performance of trading rules; how accurately the trading rules identify the bullish and bearish stock market trends; whether there is any advantage in trading daily rather than monthly; and how persistent is the outperformance delivered by the moving average trading rules. The results of this study allow us to revisit the myths regarding the superior performance of the moving average trading rules in this well-known stock market and fully understand their advantages and disadvantages.

**Chapter 10** tests the profitability of various moving average trading rules in different financial markets: stocks, bonds, currencies, and commodities. The results of these tests allow us to better understand the properties of the moving average trading strategies and find out which trading rules are profitable in which markets. The chapter concludes with a few practical recommendations for traders testing the profitability of moving average trading rules. The analysis presented in this chapter also suggests a hypothesis about simultaneous existence, in the same financial market, of several trends with different durations.

These interactive illustrations demonstrate the results of the out-of-sample tests conducted using the monthly data on the following stock market indices:

S&P Composite Stock Index;

Dow Jones Industrial Average;

Large cap stocks;

Small cap stocks;

Value stocks;

Growth stocks.

The user can define:

The start and end dates of the out-of-sample period. The start of the in-sample period is fixed to be January 1928. Note that the out-of-sample period must be long enough! If you see this error message: An error has occurred. Check your logs or contact the app author for clarification, it means that you have to increase the length of the out-of-sample period to see the results.

The amount of one-way transaction costs, in percentages;

Choose either a single (examples are MOM, MAC, etc) or a combined rule (denoted “All of them”) to test;

The type of a moving average to use in the tested rule;

The performance measure used for the purpose of optimization;

Whether to move to cash or sell short when the trading rule generate a Sell signal;

Whether to conduct a forward or a walk-forward test;

The number of years to aggregate in order to report n-year descriptive statistics.

The following single rules are tested:

MOM(n) for n in [2,18];

P-MA(n) for n in [2,18];

CDIR(n) for n in [2,18];

MAC(s,l) for s in [1,8] and l in [2,18];

MAE(n,p) for n in [2,18] and p in [0.25,0.5,…,5.0];

MACD(s,l,n) for s in [1,8], l in [2,18], and n in [2,8].

Note the following: the more the number of tested strategies, the longer the time needed to perform an out-of-sample test. Please be patient!

Panel **Plot** plots the cumulative returns and drawdowns to the buy-and-hold strategy (BH) and the moving average strategy (MA).

Panel **Outperformace** plots the 5-year rolling outperformance. The outperformance is defined as the difference between the performance measure of the moving average strategy and the performance measure of the buy-and-hold strategy.

Panel **Summary** reports the descriptive statistics of the monthly returns to the buy-and-hold strategy and the moving average strategy.

Panel **Aggregated** plots the cumulative distribution functions of the n-year returns to the buy-and-hold strategy and the moving average strategy. In addition, this panel reports the descriptive statistics of the n-year returns the buy-and-hold strategy and the moving average strategy.

It is useful to observe the following results:

The profitability of a moving average trading strategy depends on the stock price index. The best profitability seems to be attained when either a well-diversified index of large cap stocks is used (S&P 500 is an example of such index) or the small cap stock index is used.

When a well-diversified index of large cap stocks is used, the outperformance produced by the moving average trading strategy tends to be positive over a long run. However, this outperformance is usually not statistically significant at conventional statistical levels.

The out-of-sample outperformance is very uneven in time and is not guaranteed. Therefore, over short- to medium-term horizons the moving average strategy is more likely to underperform the market than to outperform.

The moving average strategy has lower mean return and lower standard deviation of returns than those of the buy-and-hold strategy. Thus the moving average strategy is not a “high returns, low risk” strategy as compared to the buy-and-hold strategy. In reality, it is a “low returns, low risk” strategy.

The main advantage of the moving average strategy lies in its ability to limit the potential losses. That is, the moving average strategy is a strategy with downside protection.