# R&D Blog

# Hull Moving Average Filter | Trading Strategy (Entry & Exit)

## I. Trading Strategy

**Developer: **Alan Hull. **Source:** Kaufman, P. J. (2013). *Trading Systems and Methods.* New Jersey: John Wiley & Sons, Inc. **Concept:** Trend following trading strategy based on low lag moving averages. **Research Goal:** To verify performance of the Hull Moving Average (HMA). **Specification:** Table 1. **Results:** Figure 1-2. **Trade Filter:** Long Trades: Two Hull Moving Averages turn upwards. Short Trades: Two Hull Moving Averages turn downwards. **Portfolio:** 42 futures markets from four major market sectors (commodities, currencies, interest rates, and equity indexes). **Data:** 36 years since 1980. **Testing Platform:** MATLAB®.

## II. Sensitivity Test

All 3-D charts are followed by 2-D contour charts for Profit Factor, Sharpe Ratio, Ulcer Performance Index, CAGR, Maximum Drawdown, Percent Profitable Trades, and Avg. Win / Avg. Loss Ratio. The final picture shows sensitivity of Equity Curve.

Tested Variables: Slow_HMA_Length, Fast_HMA_Index (Definitions: Table 1):

**Figure 1** | Portfolio Performance (Inputs: Table 1; Commission & Slippage: $0).

STRATEGY | SPECIFICATION | PARAMETERS |

Auxiliary Variables: | Hull Moving Average Formula:(A) The First Weighted Moving Average (WMA1):WMA1[i] = (Close[i − N + 1] + 2 × Close[i − N + 2] + 3 × Close[i − N + 3] + … + N × Close[i]) / (N × (N + 1) × 0.5) where: N = Hull Moving Average look back; Index: i ~ Current Bar. (B) The Second Weighted Moving Average (WMA2):WMA2[i] = (Close[i − M + 1] + 2 × Close[i − M + 2] + 3 × Close[i − M + 3] + … + M × Close[i]) / (M × (M + 1) × 0.5) where: M = round(N/2); Index: i ~ Current Bar. (C) The Hull Moving Average (HMA):Delta[i] = 2 × WMA2[i] − WMA1[i]; HMA[i] = (Delta[i − K + 1] + 2 × Delta[i − K + 2] + 3 × Delta[i − K + 3] + … + K × Delta[i])/(K × (K + 1) × 0.5) where: K = round(SquareRoot(N)); Index: i ~ Current Bar. | |

Setup: | Variables: (i) Slow_HMA_Length; (ii) Fast_HMA_Length = Fast_HMA_Index × Slow_HMA_Length. Slow Trend: Slow_HMA(Close, Slow_HMA_Length) is the Slow Hull Moving Average of the close price over a period of Slow_HMA_Length. When the Slow_HMA turns upwards, the slow trend is bullish: i.e. Slow_HMA[i] > Slow_HMA[i − 1]; Index: i ~ Current Bar. When the Slow_HMA turns downwards, the slow trend is bearish: i.e. Slow_HMA[i] < Slow_HMA[i − 1]; Index: i ~ Current Bar. Fast Trend: Fast_HMA(Close, Fast_HMA_Length) is the Fast Hull Moving Average of the close price over a period of Fast_HMA_Length. When the Fast_HMA turns upwards, the fast trend is bullish: i.e. Fast_HMA[i] > Fast_HMA[i − 1]; Index: i ~ Current Bar. When the Fast_HMA turns downwards, the fast trend is bearish: i.e. Fast_HMA[i] < Fast_HMA[i − 1]; Index: i ~ Current Bar. | Slow_HMA_Length = [60, 1000], Step = 20; Fast_HMA_Index = [0.2, 1.0], Step = 0.02; |

Filter: | Long Signal: Slow Trend & Fast Trend (Defined in the Setup) are in a bullish mode. Short Signal: Slow Trend & Fast Trend (Defined in the Setup) are in a bearish mode. | |

Entry: | Long Trades: A buy at the open is placed after a Long Signal (i.e. Slow Trend & Fast Trend are in a bullish mode). Short Trades: A sell at the open is placed after a Short Signal (i.e. Slow Trend & Fast Trend are in a bearish mode). | |

Exit: | Hull Moving Average Exit: Long Trades: A sell at the open is placed when Slow Trend or Fast Trend (Defined in the Setup) is no longer bullish. Short Trades: A buy at the open is placed when Slow Trend or Fast Trend (Defined in the Setup) is no longer bearish.Stop Loss Exit: ATR(ATR_Length) is the Average True Range over a period of ATR_Length. ATR_Stop is a multiple of ATR(ATR_Length). Long Trades: A sell stop is placed at [Entry − ATR(ATR_Length) * ATR_Stop]. Short Trades: A buy stop is placed at [Entry + ATR(ATR_Length) * ATR_Stop]. | ATR_Length = 20; ATR_Stop = 6; |

Sensitivity Test: | Slow_HMA_Length = [60, 1000], Step = 20 Fast_HMA_Index = [0.2, 1.0], Step = 0.02 | |

Position Sizing: | Initial_Capital = $1,000,000 Fixed_Fractional = 1% Portfolio = 42 US Futures ATR_Stop = 6 (ATR ~ Average True Range) ATR_Length = 20 | |

Data: | 42 futures markets; 36 years (1980/01/01−2016/06/30) |

**Table 1** | Specification: Trading Strategy.

## III. Sensitivity Test with Commission & Slippage

Tested Variables: Slow_HMA_Length, Fast_HMA_Index (Definitions: Table 1):

**Figure 2** | Portfolio Performance (Inputs: Table 1; Commission & Slippage: $100 Round Turn).

## IV. Benchmarking

We benchmark the base case strategy against alternatives:

**Case #1:** Slow_HMA_Length = 250; Fast_HMA_Index = 1 (Base Case).

**Case #2:** Slow_HMA_Length = 500; Fast_HMA_Index = 1.

**Case #3:** Slow_HMA_Length = 750; Fast_HMA_Index = 1.

**Case #4:** Slow_HMA_Length = 1000; Fast_HMA_Index = 1.

Fixed Fractional Sizing | Case #1 | Case #2 | Case #3 | Case #4 |

Net Profit ($) | 48,750,686 | 129,227,063 | 359,229,430 | 154,497,672 |

Sharpe Ratio | 0.60 | 0.75 | 0.93 | 0.86 |

Ulcer Performance Index (UPI) | 0.53 | 0.75 | 1.18 | 0.96 |

Profit Factor | 1.10 | 1.20 | 1.45 | 1.55 |

CAGR (%) | 11.50 | 14.97 | 18.94 | 16.55 |

Max. Drawdown (%) | (58.03) | (57.98) | (49.90) | (50.03) |

Percent Profitable Trades (%) | 30.80 | 29.35 | 30.51 | 30.99 |

Avg. Win / Avg. Loss Ratio | 2.48 | 2.90 | 3.31 | 3.45 |

**Table 2** | Inputs: Table 1; Fixed Fractional Sizing: 1%; Commission & Slippage: $100 Round Turn.

## V. Rating: Hull Moving Average (HMA) Filter | Trading Strategy

A/B/**C**/D

## VI. Summary

(i) The Hull Moving Average is perceived as an improved moving average with reduced lag (Figure 3); (ii) The slower frequency of trading is preferred, i.e. Slow_HMA_Length > 500 (Figure 1-2); (iii) The second moving average, the Fast Hull Moving Average, is an unnecessary complication and can be eliminated (Figure 1-2). When Fast_HMA_Index = 1, both moving averages have the same length.

**Figure 3** | Hull Moving Average (HMA) vs. Simple Moving Average (SMA) vs. Exponential Moving Average (EMA); Look Back: 100 Bars.

**Related Entries:** Zero Lag Moving Average Filter (Entry & Exit) | Simple Moving Average Filter (Entry & Exit) | Bollinger Bands – Momentum Model (Setup) | Price Momentum Model (Benchmark)

**Related Topics:** (Public) Trading Strategies

**Proprietary Strategies:**

**CFTC RULE 4.41:** HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.

**RISK DISCLOSURE: **U.S. GOVERNMENT REQUIRED DISCLAIMER | CFTC RULE 4.41

Codes: matlab/hull/hma