Every moving average has the same flaw. It tells you where price has been, and by the time it bends, a chunk of the move is already over. The hull moving average (HMA) is one trader’s answer to that problem. It uses weighted averages, a bit of arithmetic that deliberately overshoots, and a short final smoothing pass to produce a line that hugs price far more tightly than a simple average of the same length.
It isn’t magic, though. The same trick that cuts the lag also makes the line run past price when a move stalls. In this guide we’ll build the HMA from scratch, work through the numbers on a hypothetical stock, show exactly where that overshoot comes from, and talk about how its creator actually wanted it used, which is not the way most people use it.
In this article
- Where the hull moving average came from
- The idea in one small example
- The hull moving average formula, step by step
- Worked example: HMA(16) on a hypothetical stock
- The overshoot, isolated
- How Hull wanted it used
- A practical way to work with it on Indian charts
- Common mistakes with the HMA
- The hull moving average in short
Where the hull moving average came from
Alan Hull, an Australian trader and author, built the indicator in 2005. In his own write-up of the Hull Moving Average, he says he got sidetracked while working on a different indicator and started trying to solve the problem of lag in moving averages. He placed the result in the public domain, and it has since spread into charting software around the world. StockCharts’ ChartSchool entry on the HMA describes it the same way: an average that tries to minimise lag while keeping the line smooth, using weighted moving averages to lean on recent prices.
That second part matters. Making an average fast is easy: just shorten it. A 3-day average reacts quickly, but it is jumpy and throws false turns all the time. Making it smooth is also easy: lengthen it, or average the average. Hull’s point was that the usual fixes pull in opposite directions. In his article he notes that taking a 16-period SMA of a 16-period SMA smooths the curve nicely but causes “a huge increase in lag”. The HMA tries to get both at once.
The idea in one small example
Hull explains the core trick with ten numbers, 0 to 9, treated as successive prices with 9 being the latest. It’s worth walking through because everything else is built on it.
- The 10-period simple average of 0 to 9 is 4.5. That’s the midpoint of the series, and it sits well behind the latest price of 9. That gap is lag.
- Now halve the period. The 5-period average of the latest five numbers (5, 6, 7, 8, 9) is 7. Closer, but still behind.
- The difference between the two averages is 7 minus 4.5, or 2.5. Add that difference back to the short average: 7 plus 2.5 gives 9.5.
So the estimate lands at 9.5 when the real latest value is 9. Hull calls this “a slight overcompensation”, and he says it is useful, because it offsets the extra lag that the final smoothing step brings in. Keep that phrase in mind. The overcompensation is the engine of the indicator, and it is also the source of its biggest weakness.
The HMA doesn’t remove lag by being clever about the past. It removes lag by projecting a little beyond it, and that projection is exactly what makes it overshoot.
The hull moving average formula, step by step
Hull’s published formula, written for MetaStock, is:
HMA(n) = WMA[ 2 × WMA(Price, n/2) − WMA(Price, n) ], over √n periods
In plain steps, for a chosen period n:
- Weighted average over n/2 periods. A weighted moving average (WMA) gives the most recent bar the highest weight. With linear weights over 8 bars, the latest close gets weight 8, the one before gets 7, down to 1 for the oldest, and the total is divided by the sum of the weights (36).
- Weighted average over n periods. Same idea over the full window.
- The raw HMA. Double the short WMA and subtract the long WMA. This is the 0-to-9 trick in another form: short average plus the gap between short and long.
- Smooth the raw line. Take a WMA of the raw values over √n periods. For n = 16, that’s a 4-period WMA.
The documentation for the R package TTR describes its HMA function in one line: “a WMA of the difference of two other WMAs, making it very reponsive”. Its default period is 20. In the same documentation, TTR notes that the Arnaud Legoux moving average tends to put less weight on the most recent observations, “reducing tendency to overshoot”. That’s a quiet admission that overshoot is a known trait of fast averages like the HMA.
A small rounding wrinkle
n/2 and √n are not always whole numbers. Hull’s formula wraps them in Integer(), which drops the fraction. StockCharts says it rounds to the nearest whole number instead: for an 11-period HMA, 11/2 = 5.5 becomes 6, and √11 ≈ 3.317 becomes 3. So for some odd periods, two platforms can show slightly different HMA values for the same stock. If your backtest doesn’t match your charting screen, check this before anything else. Picking n = 16, 25, 36 or 64 avoids the issue on the square-root side, and an even n avoids it on the halving side.
Worked example: HMA(16) on a hypothetical stock
Let’s run the numbers. The closes below are made up for illustration. Think of a stock that grinds higher from ₹500 to ₹545 over 20 sessions and then starts to slip. We use n = 16, so the half-period WMA is 8 bars and the smoothing WMA is 4 bars (√16 = 4). No rounding questions.
Closes, bar 1 to bar 25 (₹): 500, 503, 501, 506, 510, 508, 513, 517, 515, 520, 524, 522, 527, 531, 529, 534, 538, 536, 541, 545, 540, 534, 529, 525, 522.
The first raw HMA value needs 16 bars, and the smoothing needs four raw values, so the first HMA prints at bar 19. Here is how bar 19 works out:
- WMA over the last 8 closes: ₹535.08
- WMA over the last 16 closes: ₹528.94
- Raw HMA: 2 × 535.08 − 528.94 ≈ ₹541.23 (computed on unrounded values)
- HMA: the 4-bar WMA of the raw values from bars 16 to 19, which comes to ₹539.01
The close on bar 19 is ₹541. The plain 16-day simple average on the same bar is ₹523.19. The HMA is sitting about ₹2 below price; the SMA is nearly ₹18 behind. That is the lag reduction in rupees.
| Bar | Close (₹) | 16-bar SMA (₹) | HMA(16) (₹) |
|---|---|---|---|
| 19 | 541 | 523.19 | 539.01 |
| 20 | 545 | 525.62 | 541.59 |
| 21 | 540 | 527.50 | 543.34 |
| 22 | 534 | 529.12 | 543.55 |
| 23 | 529 | 530.12 | 541.92 |
| 24 | 525 | 530.62 | 538.58 |
| 25 | 522 | 531.06 | 534.14 |
Read the table slowly. Three things stand out.
First, the turn. Price peaks at ₹545 on bar 20. The HMA keeps rising for two more bars, tops out at ₹543.55 on bar 22, and turns down on bar 23. The 16-bar SMA, meanwhile, is still rising on bar 25, when the stock is already ₹23 off its high. If you were waiting for the SMA to roll over, you’d still be waiting.
Second, look at bars 21 and 22. Price has already fallen to ₹540 and then ₹534, yet the HMA is still printing higher values above price. That’s the overshoot. The raw line was projecting the earlier uptrend forward, and the final smoothing carried that projection for a couple of bars.
Third, the HMA turned down two bars after the price peak. Faster than the SMA by a mile, but not instant. No average can call a top on the day it happens.
The overshoot, isolated
To see the overshoot on its own, take the cleanest possible case: a price that sits at ₹100 for 16 bars, jumps to ₹110 on bar 17, and then stays at exactly ₹110. No noise, no trend after the jump.
Running HMA(16) on that hypothetical series, the HMA reads ₹105.81 on bar 19, reaches ₹109.94 on bar 21, moves above ₹110 on bar 22 (₹111.28), and peaks at ₹112.51 on bar 24. Price has been flat at ₹110 the whole time. The line then drifts back down slowly, to ₹111.14 by bar 28.
So on a perfectly flat price, the HMA spent several bars above it by up to about 2.3%. On a real chart, that is exactly the moment a stock breaks out and then goes sideways: the HMA rises past price, and a trader using “close below HMA” as an exit gets shaken out of a stock that hasn’t actually done anything wrong.
On a stock that jumps and then simply holds its level, the HMA will often climb above price. Treat a close below a rising HMA after a gap as noise until the line itself turns.
How Hull wanted it used
This is where most retail usage goes off track. Hull’s own suggestion is to use the line’s turning points as entry and exit signals. He says plainly that the HMA “shouldn’t be used to generate crossover signals as this technique relies on lag”. StockCharts repeats the point: Hull does not recommend crossovers with HMAs, because a crossover system depends on the difference in lag between two averages, and the HMA has already squeezed most of the lag out.
Think about why. A classic 20/50 crossover works because the slow average is meant to be slow. If both lines are fast, they cross back and forth whenever price chops sideways. You get a lot of signals and not much information.
StockCharts outlines a turning-point approach. Shorter HMAs help find entries: when the overall trend is up and the HMA turns up, that’s a long signal; when the trend is down and the HMA turns down, a short signal. Longer HMAs, such as a 200-period HMA, can be used to judge the overall trend: rising means up, falling means down. It also cautions that, like any indicator, the HMA should be used alongside other tools.
A practical way to work with it on Indian charts
Here’s a framework we find sensible for daily charts of liquid NSE stocks or the Nifty. It follows the turning-point logic above; the specific periods are choices for you to test, not rules from any source.
- Pick one period and stick to it for a while. 16 or 25 on daily charts keeps the maths clean. Changing the period every week to match the last move is curve-fitting.
- Define the turn mechanically. For example, the HMA is “turning up” when today’s HMA is above yesterday’s after at least one lower reading. Write it down so you can backtest it.
- Use a slower filter for direction. A long HMA or even a plain 200-day average decides whether you take only long turns or only short turns. This is the “overall trend” part of the StockCharts approach.
- Respect the overshoot after gaps. Results days, block deals and index rebalancing can gap a stock and then leave it flat. As the ₹100-to-₹110 example shows, the HMA will run past price in that setup. Waiting for the HMA itself to turn avoids reacting to a cross that is just overshoot.
- Size stops from price, not from the line. Because the HMA can sit above price for a few bars after a rally stalls, a stop placed “just under the HMA” can actually be above the market. Use a recent swing low or an ATR-based distance instead.
If you like the lag-reduction idea, it’s worth comparing the HMA with the zero lag exponential moving average, which attacks the same problem from the EMA side, and with cycle-based tools like the Ehlers Cyber Cycle indicator. For where all of these fit in a wider toolkit, start with our technical analysis guide for Indian stocks.
Common mistakes with the HMA
- Running a fast-slow HMA crossover. The creator advises against it, for the reasons above. If you want a crossover system, slower averages are better suited to it.
- Reading the HMA as a support line. Because of the overcompensation, the line can sit above price after a stall. It’s a smoothed estimate of where price is heading, not a floor.
- Ignoring the warm-up. The first value needs n bars plus √n − 1 more for the smoothing; with n = 16 that is 19 bars. On a freshly listed stock, early HMA readings simply don’t exist, and a very short history makes long-period HMAs useless.
- Comparing values across platforms without checking rounding. As covered above, Hull truncates n/2 and √n while StockCharts rounds to the nearest whole number. Odd periods can give slightly different lines.
- Expecting it to call the exact top. In our worked example the HMA turned two bars after the price peak. That’s good for an average. It’s still two bars.
The hull moving average in short
The hull moving average is a weighted moving average of the difference between two other weighted averages, smoothed over the square root of the period. It cuts lag by adding back the gap between a short and a long average, which deliberately overshoots, and the final smoothing tames most of that. The payoff is a line that stays close to price and turns early. The cost is overshoot when a move stalls, especially after a sharp jump. Use its turns, not its crossovers, pair it with a slower trend filter, and keep your stops tied to price.
Disclaimer: This article is for educational purposes only and is not investment advice or a recommendation to buy or sell any security. All prices, the stock and the step-change series in the worked examples are hypothetical and were computed for illustration. Trading involves risk of loss; test any indicator-based approach on your own data and consult a SEBI-registered adviser before acting.





Leave a Reply
Join the conversation
Commenting is open to registered readers. Sign up with just your email — no password needed, and it takes under a minute.
Sign up to comment Log in