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:

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:

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

or

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