Hull Moving Average Arrows Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Alan Hull’s trick was to subtract lag rather than accept it. The hull moving average arrows indicator doubles a half-length weighted average, takes off the full-length one, then smooths what remains over the square root of the period. The line turns noticeably earlier than an ordinary average.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 3: HMA, Buy, Sell
Alerts popup
Inputs 4

What each plot looks like

One line and a pair of marks on price.

`HMA` runs dodger blue at width 2.

A lime arrow tags a turn upward.

A red arrow tags one downward.

Both sit `InpArrowOffsetPts` `8` points clear.

The pane below price stays empty.

  • HMA: line, dodger blue, width 2
  • Buy: arrow, lime, width 2, arrow code 233
  • Sell: arrow, red, width 2, arrow code 234
hull moving average arrows indicator: The Hull line and a direction turn on the EURUSD H1 chart.
The Hull line and a direction turn on the EURUSD H1 chart.

Working through the maths

Two weighted averages

Both are linear weighted. One runs at half of `InpHmaPeriod` `20`, the other at the full length. Doubling the short one and subtracting the long one removes most of the lag.

The square root pass

That result is jumpy. A third weighted average over the square root of the period smooths it, which for twenty bars means a four-bar pass.

Turning into a mark

Direction alone triggers it. The line rising where it fell before prints a buy, and the reverse prints a sell. No crossing of anything is involved.

Reading it correctly

A mark means the line changed direction.

The line turns earlier than a plain average would.

That earliness costs you some false turns.

`InpAppliedPrice` decides which price feeds all three passes.

A longer period gives fewer, larger turns.

The line itself is the only plot to watch.

Alert channels in this build: popup, one message per closed bar.

One control handles messages here. `InpAlertsOn` ships true and raises a terminal line on the closed bar where the average turns. That terminal message is the only destination this build offers.

Every Hull Moving Average Arrows Indicator input

Core settings

Setting What it does Default
InpHmaPeriod HMA period. Bars in the full-length pass, `20`. 20
InpAppliedPrice Applied price for HMA. Price the passes read, `PRICE_CLOSE`. PRICE_CLOSE

Display settings

Setting What it does Default
InpArrowOffsetPts Arrow offset (points) above/below candle. Points between mark and candle, `8`. 8

Alert settings

Setting What it does Default
InpAlertsOn Enable alerts on closed-bar signals. Alert on a closed-bar turn, `true`. on
hull moving average arrows indicator: Inputs panel with InpHmaPeriod and InpAppliedPrice.
Inputs panel with InpHmaPeriod and InpAppliedPrice.

Timeframe and symbol

Twenty bars with the lag removed behaves like a much shorter average. EURUSD H1 is the reference chart. Turns come a few times a day there. On M5 they arrive constantly. On H4 each turn marks a real leg.

What it will not tell you

Removing lag adds sensitivity to noise.

In a range the direction flips every few bars.

The line can turn without price making a new extreme.

Three weighted passes cost more calculation than one average.

Copy the compiled Hull Moving Average Arrows Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Related on forexmt4systems.com: Moving Average Crossover Strategy.

Download the Hull Moving Average Arrows Indicator for MT4 and MT5

The zip holds the compiled Hull Moving Average Arrows Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What does the third pass over InpHmaPeriod do?

It tidies up. Doubling the half-length weighted average and subtracting the full-length one leaves a jumpy result, so a final pass over the square root of the period, four bars at twenty, smooths it without restoring the lag.

How does the HMA turn earlier than a plain average?

By subtracting lag directly. Two times a half-length weighted average minus the full-length one over-corrects for the delay both carry, so the output leads what either would have given alone.

What triggers a Buy mark here?

The line changing direction, nothing else. It has to be rising where it was falling on the previous bar. No cross of price, of a second line, or of a level is involved anywhere.

Does InpAppliedPrice affect all three passes?

Yes. The one setting feeds the half-length average, the full-length one and therefore the smoothed result too, so switching it away from the close changes the whole line rather than part of it.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Hull Moving Average Arrows Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Also, truly, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment