Moving averages and exponential moving averages (EMAs) are ubiquitous in automated trading. They are used both as a graphical tool and in the quantitative treatment of numerical data since they are a simple and computationally efficient way of filtering out high frequency noise in the data. They act as a low pass filter. Technicians and traders alike use them on charts and as building blocks in their quantitative backtests. An EMA can simply be written recursively as the weighted combination of its previous value and the latest data:
EMA(t) = alpha*x(t) + (1-alpha)*EMA(t-1).
The smaller the alpha parameter is, the more efficiently noise is going to be filtered out - but the less responsive the EMA is going to be when a genuine move appears in the data.
Over the years, numerous schemes of various complexity have been designed to reduce the EMA lag, i.e. the average delay between the signal and the filtered signal for a given amount of smoothing. In this article we are going to focus on the approach developed by Tim Tillson [Tillson, 98] building on the idea of 'twicing' by John Tukey [Tukey, 76]. Let's introduce the idea step-by-step: First let's define lag as the difference between signal and the output of an EMA:
lag = x - EMA(x).
Now we consider an EMA with a modified input: Instead of using the raw signal x, we add the lag to the latter and use this as an input of the EMA, to give it some sort of 'head start':
EMA(x+lag) = EMA(x + x - EMA(x))
= EMA(2*x - EMA(x)).
Given that the EMA is a linear operation
EMA(a*x+y) = a*EMA(x) + EMA(y)
EMA(x+lag) = 2*EMA(x) - EMA(EMA(x))
We can quantitatively study the behavior of this new EMA filter. A filter is characterized by two quantities: The 'lag' or average delay for a signal of various frequency, and the 'gain' or response of the filter to the signal amplitude. The smaller the lag and the closer the gain to 1.0, the better the filter. The lag plot on Figure 01 compares the lag of an EMA and the lag of the twicing EMA - it clearly shows that the lag has been reduced.