Skip to main content
On this page

Hull Moving Average Strategy: Formula, Signals, and Testing

· 4 min read
Pineify Team
Pine Script and AI trading workflow research team

The Hull Moving Average combines weighted moving averages to reduce lag while smoothing a price series. That is a calculation property, not evidence that an HMA strategy enters profitably sooner or produces fewer losing trades. Define the signal and compare it under consistent test assumptions before drawing a performance conclusion.

Hull Moving Average Strategy: Master This Powerful Trading Indicator Guide

Calculate the HMA without mixing average formulas​

Alan Hull's original explanation describes the construction using a full-period WMA, a half-period WMA, and a final WMA whose period is based on the square root of the original length:

HMA = WMA(2 × WMA(price, n/2) − WMA(price, n), sqrt(n))

The implementation must convert period lengths to integers. Check the target platform's rounding convention, especially for odd lengths, before comparing two implementations. For a 16-period illustration, the intermediate lengths are 8 and 16, with a final 4-period WMA.

The final operation is a WMA. It is not EMA smoothing with a factor of 2 / (sqrt(n) + 1). That substitution produces a different indicator. TradingView's HMA reference documents the weighted-average construction.

Choose one signal definition​

RuleObservable conditionQuestion to test
Slope changeHMA changes from falling to rising, or the reverseDoes the change persist after confirmation?
Price crossingPrice moves from one side of HMA to the otherDoes the entry survive costs and repeated reversals?
Two-HMA crossingA faster HMA crosses a slower oneDoes this variant add value over the simpler rule?
Trend filterAnother entry rule is allowed only with an HMA directionDoes the filter improve results outside the development sample?

These are different hypotheses. Hull's original discussion emphasizes turning points and cautions against crossover techniques; do not attribute every popular crossover variation to his recommendation. A rising HMA describes its own calculated direction, not a guarantee that price will continue upward.

Compare settings on matching data​

Keep the symbol, source, timeframe, dates, and fill assumptions fixed when comparing HMA with SMA or EMA. Their different weighting schemes mean the same nominal length does not imply identical lag or smoothness. Define “earlier” and “whipsaw” before measuring them, and report the full sample rather than selected chart examples.

Shortening a period can increase responsiveness and signal frequency. Lengthening it can smooth some variation while delaying changes. No universal ranking of 9, 16, 21, or 55 periods is established here. Inspect sensitivity across nearby values and evaluate a period not used to choose the setting.

Test orders, costs, and drawdown​

An HMA overlay alone is not a backtest. A strategy must define entry timing, exit timing, position size, allowed direction, costs, and what happens at the sample boundary. Bar-close signals and next-bar fills should not be confused with fills at the most favorable intrabar price.

For an illustrative stock position, a $100 planned risk budget divided by a $2 entry-to-stop distance gives 50 shares before fees and slippage. That arithmetic does not guarantee a $100 maximum loss: gaps and execution can move the fill beyond the stop. A 2:1 target ratio likewise does not guarantee positive expectancy when realized outcomes differ from the plan.

The trailing-stop guide distinguishes plotted levels, strategy exits, and broker orders. Keep those layers separate when turning an HMA idea into a system.

Build an implementation you can inspect​

Add TradingView's HMA and record its inputs before constructing custom signals. If using another platform, verify that the chosen HMA implementation matches the intended formula; do not assume every platform ships the same built-in study.

Pineify Website

Pineify can help express an HMA rule in Pine Script. Check the generated periods, confirmation timing, and order logic against the specification. Combining HMA with MACD, RSI, or a volume condition changes the rule set; it does not automatically supply independent evidence or improve accuracy.