VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

Hull moving average: less lag than EMA or SMA, but better signals?

The Hull moving average turns a few bars earlier than an EMA or SMA of the same length. That speed helps in a trend and hurts in a range, where every extra flip is a trade that pays commission and slippage. Whether its signals are better is a question for a backtest after costs, run against a plain trend rule on the same data.

By · Published · updated · Editorial policy

Contents
  1. Does the Hull moving average give better signals than EMA or SMA?
  2. How is the Hull moving average calculated?
  3. How do you choose the Hull MA length?
  4. How do you read trend direction from the Hull MA?
  5. Why does the Hull MA whipsaw in sideways markets?
  6. How do you backtest the Hull MA against a plain trend rule?
  7. Frequently asked questions
  8. References

Does the Hull moving average give better signals than EMA or SMA?

The Hull moving average turns earlier than an EMA or SMA of the same length, but it does not give better signals on its own. In a trending market the earlier turn gains a few bars. In a sideways market it produces more false turns, and each one is a trade that pays commission and slippage. A backtest after costs decides, not the chart.

The Hull moving average is a moving average built from three weighted moving averages, arranged so that most of the delay of a normal average is removed. Lag is the number of bars between a turn in price and the turn in the line that follows it. A simple moving average (SMA) of 16 bars gives every bar the same weight, so it reacts slowly. An exponential moving average (EMA) weights recent bars more, so it reacts sooner. The Hull MA (often listed as the HMA indicator on charting platforms) reacts sooner still. On the same top in price, the three lines turn down in the same direction, only at different bars.

After the same price top, three 16-bar lines turn down at different bars in an illustrative example: the Hull MA 2 bars later, the EMA 5 bars later and the SMA 8 bars later, all in the same direction The Hull MA turns first Bars after one price top, illustrative Hull MA +2 bars EMA +5 bars SMA +8 bars All three turn the same way. So: let a backtest after costs judge.
The same top, three 16-bar lines. The Hull MA turns first, but all three turn the same way; the gain is a few bars, not a different signal.

That is the claim this article tests: speed is not quality. A faster line gives you a better entry when the move continues and a worse one when it does not, and the balance between the two is what a backtest measures. Where the Hull MA sits among other tools, and which of them can be written as exact rules at all, is covered in which technical analysis tools and indicators you can actually test.

How is the Hull moving average calculated?

The Hull MA is three weighted moving averages combined in a fixed order: remove the lag first, then smooth the result. A weighted moving average (WMA) is an average in which the newest bar gets the largest weight and each older bar gets one step less, down to the oldest bar in the window. For a length n the steps are:

  1. Take a WMA of half the length (n/2) and a WMA of the full length (n).
  2. Double the half-length WMA and subtract the full-length WMA. The short average runs ahead of the long one, and the subtraction pushes the result ahead of price's average, which cancels most of the lag.
  3. Smooth that difference with a WMA whose length is the square root of n. The second step adds jaggedness; the short final WMA takes it back out without adding much delay.

Written as one formula:

HMA(n) = WMA( 2 × WMA(n/2) − WMA(n), √n )

Here HMA(n) is the Hull MA of length n, WMA(n/2) is the weighted average over half the bars, WMA(n) is the weighted average over all n bars, and the outer WMA(…, √n) is a weighted average of that difference over a window as long as the square root of n. Half lengths and square roots that are not whole numbers are rounded to whole bars.

How HMA(16) is built: step 1 takes a WMA of 8 bars and a WMA of 16 bars, step 2 computes two times WMA(8) minus WMA(16) to remove lag, step 3 smooths that difference with a WMA of 4 bars HMA(16) in three steps Remove the lag, then smooth 1 2 3 WMA(8), WMA(16) Two averages 2×WMA(8) − WMA(16) Lag removed WMA(4) of step 2 Smoothed Result: HMA(16), little lag. So: expect speed and more noise.
HMA(16) step by step: two weighted averages, a subtraction that removes lag, and a short final average that smooths the result.

The same idea of subtracting a slow average from a doubled fast one is used by the double exponential moving average, which is built from EMAs instead of WMAs and has no final smoothing step. The DEMA indicator and how it cuts EMA lag covers that construction. The Hull MA goes one step further: WMAs respond faster than EMAs of the same length, and the square-root smoothing is short, so the finished line hugs price more closely than either DEMA or EMA. Closeness to price is exactly what makes it fast in a trend and noisy in a range, as the later sections show.

How do you choose the Hull MA length?

Choose the length from the number of bars in the kind of move you want to follow, then test a band of neighbouring lengths rather than one value. A Hull MA that follows a 20-bar swing needs a length near 20; one that follows a 60-bar trend needs a length near 60. The common Hull MA settings of 9, 16, 25 and 49 are popular because their square roots are whole numbers (3, 4, 5 and 7), not because they match any market.

The same length means a very different stretch of time on different bar sizes, so a setting that someone reports for daily bars says nothing about a 5-minute chart:

LengthHalf lengthSquare-root lengthSpan on 5-minute barsSpan on daily bars
94345 minabout 2 weeks
168480 minabout 3 weeks
25125about 2 habout 5 weeks
49247about 4 habout 10 weeks
Hull MA lengths 9, 16, 25 and 49 with their half lengths 4, 8, 12, 24, square-root lengths 3, 4, 5, 7, and spans of 45 minutes to about 4 hours on 5-minute bars versus about 2 to 10 weeks on daily bars Same length, different time Length n/2 √n 5-min Daily 9 4 3 45 min ~2 weeks 16 8 4 80 min ~3 weeks 25 12 5 ~2 h ~5 weeks 49 24 7 ~4 h ~10 weeks 16 bars: 80 min or 3 weeks. So: set length on your own bars.
One length, two very different time spans. The half and square-root lengths that the formula uses follow from the length you pick.

A practical order of steps:

  1. Measure, on your own bar size, how many bars a typical move you want to catch lasts. Count ten or twenty past moves and take the middle value.
  2. Start with a length near that count. If the moves last about 20 bars, test the band from 14 to 28, not the single value 20.
  3. Read the results of the whole band together. A length that does well while its neighbours do poorly describes noise in that history; a band where neighbouring lengths behave alike describes something the market actually did. Parameter stability: plateau or lucky spike shows how to read that surface.

How do you read trend direction from the Hull MA?

The two usual signals are a turn in the slope of the line and a close crossing the line, and they behave differently: the slope turn fires earlier and more often, the cross fires later and less often. A slope turn is the bar on which the Hull MA value changes from falling to rising (or rising to falling). A price cross is the bar on which the close moves from one side of the line to the other. Because the Hull MA hugs price, the close spends most of its time near the line, and a cross can come several bars after the slope has already turned.

SignalRule as writtenFiresFrequencyTypical use
Slope turnHMA today > HMA yesterday, and HMA yesterday < HMA two bars agoEarly, at the first up-bar of the lineHigh; every wobble of the line is a signalTrend direction, colouring the line
Price crossClose today > HMA today, and close yesterday < HMA yesterdayLater, once price has pulled away from the lineLower; small wobbles do not crossEntry and exit trigger
On one illustrative trending stretch, the Hull MA slope signal fires at bar 0 and gives 7 signals, while the price cross fires at bar +3 and gives 3 signals Slope turns first and often One trending stretch, illustrative Fires at Signals Slope turn bar 0 7 Price cross bar +3 3 The cross is later, but rarer. So: write either as an exact rule.
Same stretch, two signals. The slope turns first and often; the cross comes later and less often.

Either signal must be written as an exact rule before it can be tested, with the bar it fires on and the bar it fills on stated. Next-bar execution is the rule that a signal read at the close of one bar is filled at the open of the following bar, because the close that triggered the signal is already gone when you see it. A complete long rule reads like this:

  1. Compute HMA(16) on closed bars only.
  2. At the close of a bar, if HMA(16) is above its value one bar earlier and was below it two bars earlier, flag a long entry.
  3. Fill the entry at the open of the next bar.
  4. At the close of a later bar, if HMA(16) is below its value one bar earlier, flag the exit; fill it at the open of the next bar.

Written this way, the rule has no judgement left in it, so two people running it on the same data get the same trade list. A rule such as "enter when the Hull MA turns green" is not testable until it is turned into statements like these.

Why does the Hull MA whipsaw in sideways markets?

The construction that removes lag also lets more of the bar-to-bar noise through, so in a range the slope of the Hull MA flips back and forth while a slower line barely moves. A whipsaw is a signal that reverses soon after it fires, so the trade is closed at a small loss and often re-opened in the other direction. An SMA of 16 bars averages the noise of a flat range away; the Hull MA of 16 bars, with its effective reaction time of only a few bars, follows the small swings inside the range and turns at each one.

In an illustrative flat 40-bar range, the Hull MA slope flips 6 times and the SMA of the same length flips once; each flip is a trade that pays commission and slippage Fast lines flip in ranges Flat 40-bar range, illustrative Hull MA 6 flips SMA 1 flip One trade that pays costs Six round trips against one. So: add a filter, then retest.
In a flat range the low-lag line flips many times and the slow line once. Each flip is a round trip that pays costs.

Hypothetical example

Suppose a 40-bar range in which the Hull MA slope flips six times and the SMA slope flips once. Suppose each false flip costs $150 of price movement plus $45 of commission and slippage, and the one true move at the end of the range gains $900 before costs for either line. The Hull MA rule ends the stretch at about 6 × (−$195) + $855 = −$315. The SMA rule ends at about −$195 + $855 = $660, even though it entered the final move later. The numbers are invented; the shape is what matters: the faster line loses the range and must win it back in the trend.

Traders who keep the Hull MA for its speed usually add a filter that stops the slope signal from firing in a range, and each filter buys fewer flips with later entries:

  • A momentum filter. Take the slope turn only when the MACD line and its signal line agree on direction. Ranges give small, crossing MACD values, so many flips are skipped.
  • An overbought or oversold filter. Take long slope turns only when the stochastic oscillator's %K and %D are below a chosen level, so the entry comes from a pullback rather than from the middle of a range.
  • A minimum slope size. Require the Hull MA to rise by more than a set number of ticks per bar before the turn counts. Small wobbles inside a range do not reach the size; the start of a real move does.

Every filter is another parameter, so the band-of-neighbours test from the length section applies to it too: a filter threshold that works at one value only is as suspect as a length that does.

How do you backtest the Hull MA against a plain trend rule?

Run the Hull MA rule and a plain trend rule on the same market, bar size, period and costs, and judge both on average trade after costs and on how their neighbouring settings behave. A plain trend rule is any simple rule that is long while price shows an uptrend and short while it shows a downtrend, such as an SMA cross or a channel breakout. It is the yardstick: if the Hull MA rule does not beat it after costs on the same data, its speed bought nothing. Research on simple moving average rules has long made the same point. Brock, Lakonishok and LeBaron (1992) found patterns behind basic moving average rules on a long stock index history, and Park and Irwin (2007), reviewing later studies, found that results depend heavily on costs and on how many rules were tried before one was reported.

Six steps for a fair comparison: fix the data, set costs once, write the plain rule, write the Hull rule with the same fills, run both after costs, and keep a rule only if neighbouring lengths agree Change only the rule Same data, costs and fills for both 123 456 Fix data Set costs Plain rule Hull rule Run both Neighbours one period once, shared exact entry same fills after costs must agree
A fair comparison changes one thing only: the rule. Everything else is set once and shared.
  1. Pick the market, the bar size and the period, and keep them fixed for both rules.
  2. Set commission, slippage and next-bar execution once. How to pick the cost figures is covered in trading costs in backtests.
  3. Write the plain trend rule as an exact entry and exit.
  4. Write the Hull MA rule the same way, with the same fill timing.
  5. Run both and read the average trade after costs and the trade count side by side. A rule with twice the trades needs twice the gross edge per trade to end in the same place.
  6. Rerun each with neighbouring lengths. Keep a rule only if its neighbours agree with it.

The run below shows what a plain trend rule looks like on real data when the comparison is set up this way. It tests a stand-in rule, not the Hull MA itself: an Aroon rule, which goes long when the bars since the recent high are fewer than the bars since the recent low and short in the reverse case, used as the only entry and exit with no stop, target or filter. The market is ES (E-mini S&P 500 futures), the bar size is daily, and the period runs from 2019-01-02 to 2025-06-30, long and short, one contract, with $20 commission and $25 slippage charged per trade.

Source: AlphaPrime product engine (CPU), run 2026-10-31. ES daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $25 slippage per trade.

NumberResult
Net profit (closed trades)$142,107.5
Max drawdown$58,717.5
Trades34
Win rate64.71%
Profit factor2.987
Average trade$4,179.63
Time in market91.22%

Read the trade count first. Thirty-four trades over six and a half years is what a slow daily trend rule produces, and it is a small sample: the average trade of $4,179.63 rests on a handful of large winners, and a different six years could rearrange them. This candidate is the one the search kept out of about a thousand it tried, chosen for its return against its drawdown. Picking the best one after the fact flatters it, because among a thousand candidates on one history some will look strong by chance alone; Bailey, Borwein, López de Prado and Zhu (2014) show how quickly that inflation grows with the number of trials. The numbers describe what this one rule did on this one stretch of past prices, not what the Aroon rule or any trend rule earns, and not what a reader should expect. In AlphaPrime (Valynox), the same $20 commission, $25 slippage and next-bar fill are applied inside every candidate's backtesting, so when you put a Hull MA rule next to this one the only thing that differs is the rule.

Follow the equity line across the whole period and note the long flat and falling stretches between the steps up. The maximum drawdown of $58,717.5 is one of those stretches; a trader using this rule would have sat through it without knowing when it would end.
Follow the equity line across the whole period and note the long flat and falling stretches between the steps up. The maximum drawdown of $58,717.5 is one of those stretches; a trader using this rule would have sat through it without knowing when it would end. ES · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest
HMA and DEMA both answer trend direction, so DEMA repeats the HMA and should replace it; MACD answers momentum and the stochastic answers pullback timing, so both can serve as filters Add only a new question Which tools repeat the HMA's job Indicator Answers Repeats? Use HMA DEMA MACD Stochastic Direction Direction Momentum Pullback — Yes No No Base rule Replace Filter Filter
Read the four numbers together: trade count, profit factor, maximum drawdown and net profit. A high profit factor from 34 trades says less than the same profit factor from several hundred. ES · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

The time in market of 91.22% tells you something else about plain trend rules: this one was almost always in a position, long or short, so its result is largely the sum of the market's big moves over the period, minus the whipsaws between them. A Hull MA rule on the same bars would flip more often, hold less of each move's tail, and pay costs on more trades. Whether that trade-off ends ahead or behind the plain rule is the question to put to your own data.

Your next step: on the market and bar size you trade, write an SMA cross rule and a Hull MA slope rule as exact entries and exits with next-bar fills, run both over the same years with the same costs, and compare the average trade after costs and the trade count. Then rerun the Hull MA rule at every length from four below to four above your choice. If the band agrees, you have something worth a walk-forward test; if only one length works, you have found noise.

Frequently asked questions

Is the Hull MA better than the SMA?

The Hull MA reacts to a turn in price several bars sooner than an SMA of the same length, so it enters and exits trends earlier. In a sideways market it also flips direction far more often, and each flip is a trade that pays commission and slippage. Neither line is better in general; the one that ends ahead after costs on your market, bar size and period is the better one for you, and only a backtest with the same costs for both can show which that is.

What are the best Hull MA settings?

There is no single best length. Common Hull MA settings are 9, 16, 25 and 49, chosen because their square roots are whole numbers. Match the length to the number of bars in the moves you want to follow on your own bar size, then test the neighbouring lengths as a band. Keep a length only if the lengths around it behave in a similar way.

Does the Hull moving average repaint?

The Hull MA is computed from past closes, so a completed bar's value does not change later. The value on the bar that is still forming moves with every tick until that bar closes, which is true of every moving average. To avoid acting on a value that may still change, read the signal at the bar close and fill it at the open of the next bar, and set your backtest the same way.

What is the difference between the Hull MA and DEMA?

Both remove lag by doubling a faster average and subtracting a slower one. DEMA uses exponential moving averages and stops there. The Hull MA uses weighted moving averages, which react faster, and then smooths the difference with a short weighted average of square-root length. The result is a line that sits closer to price than DEMA, which makes it faster in trends and noisier in ranges.

References

  • Brock, W., Lakonishok, J., & LeBaron, B. (1992). Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. The Journal of Finance, 47(5), 1731–1764.
  • Park, C.-H., & Irwin, S. H. (2007). What Do We Know About the Profitability of Technical Analysis? Journal of Economic Surveys, 21(4), 786–826.
  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.