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 Moving Average Change of Direction rule and the anatomy of this rule.
In this rule, the time \(t\) value of a moving average is compared with the time \(t-1\) value of this moving average. A Buy signal is generated when the value of a moving average has increased over the last period.
Formally, the technical trading indicator for the Moving Average Change of Direction rule is computed as: \[ \text{Indicator}_t^{\text{$\Delta$MA}(n)} = MA_t(n) - MA_{t-1}(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 \(\Delta MA(n)\) rule.
The Anatomy of the rule panel plots the price-change weighting function of the \(\Delta 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.