Interactive illustrations to Chapters 4 and 5 of the book Market Timing with Moving Averages: The Anatomy and Performance of Trading Rules by Valeriy Zakamulin
Chapter 4 reviews the most common trend-following rules.
Chapter 5 uncovers the anatomy of trend-following rules and demonstrates that the computation of a technical trading indicator for any rule can alternatively be given by the following simple formula \[ \text{Indicator}_t^{TR(n)} = \sum_{i=1}^{n-1} \pi_i \Delta P_{t-i}. \] In words, any trading indicator is computed as a weighted average of price changes over the averaging window. The price-change weighting function \(\pi_i\) of a trading rule reveals the anatomy of this rule.
These interactive illustrations demonstrate the trading with the Price Minus Moving Average rule and the anatomy of this rule.
In this rule the last closing price is compared with the value of a moving average. A Buy signal is generated when the last closing price is above the moving average. Otherwise, if the last closing price is below the moving average, a Sell signal is generated.
Formally, the technical trading indicator for the Price Minus Moving Average rule is computed as: \[ \text{Indicator}_t^{\text{P-MA}(n)} = P_t - MA_t(n), \] where \(MA\) denotes a moving average (SMA, LMA, EMA, etc).
In the Application to S&P 500 panel, the top figure plots the monthly values of the S&P 500 index and the value of the selected moving average. The shaded areas in this plot indicate the periods where this rule generates a Sell signal. The bottom figure plots the values of the technical trading indictor of the \(P-MA(n)\) rule.
The Anatomy of the rule panel plots the price-change weighting function of the \(P-MA(n)\) rule.
One can change the data range, the type of a moving average, and the size of the window, \(n\), to compute the trading signal.