Hull moving average

Hull moving average

The Hull Moving Average solves the age-old dilemma of making a moving average more responsive to current price activity whilst maintaining curve smoothness. In fact, the HMA almost eliminates lag and manages to improve smoothing at the same time.

To understand how it achieves both of these opposing outcomes simultaneously we need to start with an easily understood frame of reference. The following chart contains a 16-week simple moving average which constantly lags the price activity and has poor smoothness.


There are multiple reasons for posting this indicator into MetaTrader 4 codebase :

  • the eternal “need for speed” cause: Hull average is (regardless of how it is calculated) a CPU-intensive calculation. This version is solving that by avoiding loops where they usually are used
  • this version is the variation that allows you to specify the “speed” of the Hull average and thus to adjust the Hull (that tends to be overshooting in its original form) to our needs
  • there are countless versions of Hull average, using countless names, that are showing the two-colored line – and a lot of them are repainting. This one is a non-repainting version

Hull Moving Average (HMA) formula

Integer(SquareRoot(Period)) WMA [2 x Integer(Period/2) WMA(Price) – Period WMA(Price)]

Register to download