TRADING SYSTEMS

Removing Lag, Forecasting Data

Trading Indexes With The Hull Moving Average 

by Max Gardner

Moving averages smooth data and make it easier to analyze price movements, but they tend to lag. Here’s a market timing system that removes the lag and forecasts future data.

Buy & hold works well as the market goes up, but the strategy falls apart when the market tanks. We need a timing model to preserve capital in down markets and identify opportunities in up markets. Is it possible?

Moving averages are often the best way to eliminate data spikes, and those of relatively long lengths smooth data as well. However, moving averages have a major flaw, in that their long lookback periods introduce lag. The solution is to modify the moving average formula and remove the lag. Doing so minimizes the possibility of the moving average overshooting the raw data when predicting the next interval’s activity and thus introducing errors. Here’s how it can be done.

Removing the lag
A new type of moving average developed by trader Alan Hull attempts to solve this problem. In this variation, a simple moving average (Sma) is the summation of data samples divided by the number of samples (N). The Hull moving average (Hma) accomplishes the smoothing by using the weighted moving average (Wma) and a square root of N. The calculation is thus:

	
    HMA(N) = WMA(2*WMA(N/2) –
             WMA(N)),sqrt(N))
	

To step through this formula: Take the Wma of the last N/2 data and multiply it by 2. Then subtract the Wma of the last N data. Now take that value and use the square root of N. Then find the Wma of those two values (that is, the Wma [sqrt of N] of the remembered value). Since the square root truncates values, the calculation should choose an N that is a perfect square such as 4, 9, 16, 25, 49, or 81.

Comparing the Sma and Hma in Figure 1 using an 81-day average, we find that the Hma is both smooth and responsive to the changing data, while the Sma lags behind.

Image 1

Figure 1: simple ma vs. hull ma. Here you see a comparison of the SMA and HMA using data from the QQQQ ETF. The HMA is more timely than the SMA. A nine-day average is shown with the HMA in blue.

…Continued in the December issue of Technical Analysis of Stocks & Commodities

Return to Contents