HullAverage
HullAverage[period](price) in ProBuilder returns the Hull Moving Average, a fast weighted moving average designed to cut lag while keeping a smooth line.
Syntax
HullAverage[period](price)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
period | integer | 20 | Main lookback period. Common values range from 9 for fast signal lines to 50 or more for trend definition. |
price | price source | close | Series the average is computed on, for example close, open, high, or low. |
Formula
HMA[N] = WMA[sqrt(N)]( 2 * WMA[N / 2](price) - WMA[N](price) )where WMA is a linearly weighted moving average. The half-length average is doubled and the full-length average subtracted, which cancels most of the lag; the final weighted average over sqrt(N) bars smooths the result.
How it works
Alan Hull designed the HMA to attack the usual trade-off of moving averages: smoothness requires a long window, but a long window means lag. The construction works in two steps. First, 2 * WMA(N/2) - WMA(N) extrapolates ahead, the faster half-length average is pushed forward by subtracting the slower one, largely removing delay but adding noise. Second, a short weighted average of length sqrt(N) is applied on top, restoring smoothness without reintroducing much lag.
The result is a line that turns with price almost immediately compared with a simple or exponential average of the same period. That responsiveness comes with a caveat: the extrapolation step can overshoot around sharp reversals, briefly exaggerating the turn.
Because the HMA hugs price closely, crossover systems built on it usually use its slope, whether the line rose or fell versus the previous bar, rather than price crossing the line, which happens too often to be useful on its own.
Examples
Example 1, Hull Moving Average on the chart (Indicator)
// 30-period Hull Moving Average of the close
myHMA = HullAverage[30](close)
RETURN myHMA AS "HMA 30"Plots a 30-period HMA over the price chart. Compared with Average[30], the line turns noticeably earlier at swing points.
Example 2, Slope-based trend system (ProOrder)
// Enter long when the HMA turns up, exit when it turns down
hma = HullAverage[20](close)
IF NOT LongOnMarket THEN
// Slope flips from down to up
IF hma > hma[1] AND hma[1] <= hma[2] THEN
BUY 1 CONTRACT AT MARKET
ENDIF
ELSE
IF hma < hma[1] THEN
SELL AT MARKET
ENDIF
ENDIFTrades the direction of the HMA itself. The slope flip is the standard HMA signal, exploiting the line's low lag instead of waiting for a price crossover.
Example 3, Screening for fresh HMA upturns (ProScreener)
hma = HullAverage[20](close)
// Line was falling two bars ago, rising now
cond = hma > hma[1] AND hma[1] <= hma[2]
SCREENER[cond](hma AS "HMA 20")Returns instruments whose 20-period Hull Moving Average has just turned upward on the current bar.
Interpretation
The two standard readings are slope and relative position. A rising HMA indicates a bullish trend, a falling HMA a bearish one, and because the line reacts quickly, its turns are treated as early trend-change signals. A second common setup pairs a short and a long HMA: a short-period line turning up while the longer one is already rising is read as bullish alignment, and the mirror image as bearish.
The low lag cuts both ways. Signals arrive earlier than with classic averages, but in sideways markets the line turns frequently and generates whipsaws. A regime filter, a higher-timeframe trend condition, or simply a longer period reduces the false turns.
Common errors and gotchas
- Wrong bracket type. The period goes in square brackets, the price source in parentheses:
HullAverage[30](close).HullAverage(30, close)raises a syntax error. - Overshoot at V-reversals. The
2 * WMA(N/2) - WMA(N)step extrapolates the recent slope, so the line can spike beyond price right after abrupt turns. Signals taken during such spikes are less reliable. - Price-cross signals fire constantly. Because the HMA tracks price so closely,
close CROSSES OVER hmatriggers far more often than with a simple average of equal period. Slope-based conditions are the intended usage. - Treating it as a support level. Unlike slower averages, the HMA is not a meaningful dynamic support or resistance line, it sits too close to price. Use it for direction and timing, not as a level.
Related instructions
WeightedAverage, the building block of the Hull construction.Average, simple moving average for comparison.ExponentialAverage, classic reduced-lag alternative.ZLEMA, zero-lag exponential moving average, similar goal.DEMA, double exponential moving average.TEMA, triple exponential moving average.AdaptiveAverage, average that adjusts speed to market conditions.EndPointAverage, regression-based low-lag average.
