# Why moving average strategies are a special case of AR model

#1

The goal of this note is to show how a trend-following moving average trading strategy is a special case of an autoregressive model for the underlying price timeseries.

The trend-following strategy that we will consider is the following:

We have an asset and its price as a timeseries. To determine the trend of the price we pick two periods - long and short - and compute two moving averages of the price, one for each period. If it turns out that the longer-term moving average is lower than the shorter-term, then we predict that the price will be rising so we buy (or go long). Otherwise we sell (go short).

Let’s formalize this. We’ll use x(t) to denote the price of the asset at time t. x(t) is a timeseries. We’ll assume that time here is integer, i.e. t= 0,1,2,\dots

Then we define the moving average function:

\mathrm{MA}(t,k) = \frac{1}{k}\sum_{i=0}^{k-1}x(t-i)

Assume that we have two periods k_s and k_l, with k_s < k_l. Then, according to the trend-following strategy, our action at time t depends on the following quantity:

\mathrm{Trend}(t,k_s,k_l) := \mathrm{MA}(t-1,k_s) - \mathrm{MA}(t-1,k_l)

Namely, if the trend \mathrm{Trend}(t,k_s,k_l) is positive, we predict that the returns at time t will be positive, in other words we predict that x(t)-x(t-1)>0. Conversly if the trend is negative we predict that the returns will also be negative.

In that case it makes sense to model the returns at time t as a linear regression on the trend with zero constant coefficient

x(t) - x(t-1) \sim \alpha \mathrm{Trend}(t, k_s,k_l), \alpha > 0

or

\begin{split} x(t) &\sim x(t-1) + \alpha \left(\frac{1}{k_s}\sum_{i=1}^{k_s}x(t-i) - \frac{1}{k_l}\sum_{i=1}^{k_l}x(t-i)\right)\\ \alpha &> 0 \end{split}

This is a special case of an \mathrm{AR}(k_l) model for x(t).