Hull Moving Average
A weighted moving average already leans on recent bars more than an SMA, but it still lags the same way any moving average does. Hull's construction computes a WMA over the full period and a second WMA over half the period, takes twice the fast one minus the slow one, and runs that difference series back through a third WMA sized to the square root of the original period. The middle step is not cosmetic - it is what removes the lag - and the final smoothing pass is what keeps the result from being jagged. This is implemented as the literal three-stage formula, not an approximation: two calls to the platform's own iMA() in MODE_LWMA build the raw difference series, and a manually weighted sum over that series performs the final stage, because the final WMA is applied to a derived series that iMA() itself cannot see. Notes and limitations - Needs InpPeriod + round(sqrt(InpPeriod)) bars of history before the first value appears; earlier bars are intentionally left empty rather than guessed. - Less lag does not mean no lag or no false turns - the Hull line can still wobble in a choppy range like any short-period average. - Recalculated per bar from price directly, with no dependency on its own previous value, so there is nothing here that can repaint or drift.
Indicator · MT4 · v1.0 · Free
About Hull Moving Average
Hull Moving Average is an indicator for MetaTrader 4 based on Moving Average. It has 2 settings, such as Period and Applied price. MQL source code included.
Files in the download: HullMa.ex4, HullMa.mq4, HullMa.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Period | 20 | Hull period |
| Applied price | PRICE_CLOSE | Applied price |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · MT4 Indicator · MQL4 Source Code