A weighted moving average designed to reduce lag while staying relatively smooth.
The Hull Moving Average (HMA) is a trend-following moving average developed by Alan Hull in 2005. It is built from weighted moving averages (WMAs) and is designed to follow price more responsively than a traditional simple or exponential moving average, while remaining reasonably smooth. Traders typically plot it as a single line over price and use it the way they use other moving averages — as a visual reference for the prevailing direction of price. Like all moving averages, the HMA is a lagging, derived calculation: it summarizes past prices and is not predictive. Trading involves risk of loss, and no indicator removes that risk.
The HMA combines three weighted moving averages to cut lag. For a chosen length n, it computes a WMA over n/2 periods and a WMA over the full n periods, then forms the series (2 x WMA(n/2)) - WMA(n). This step emphasizes recent prices to pull the line closer to current price. A final WMA whose length is the square root of n (rounded down to a whole number) is applied to that series to smooth the result. Because WMAs weight recent bars more heavily, and because the intermediate step subtracts the slower full-length average, the HMA tracks price with less delay than an equal-length SMA or EMA. The trade-off is that the final smoothing window is short, so the line can react quickly to fast moves. In Pine Script v6 this whole calculation is available as the built-in ta.hma().
A length of around 9, 16, or 20 on the chart's price source (close) is common, but the right value depends entirely on your timeframe and how much smoothing you want. Shorter lengths react faster and whipsaw more; longer lengths are smoother and slower.
//@version=6
indicator("Hull Moving Average", overlay = true)
length = input.int(20, "HMA Length", minval = 2)
src = input.source(close, "Source")
hma = ta.hma(src, length)
// Color the line by its slope (rising vs falling) for visual context only.
hmaColor = hma > hma[1] ? color.teal : color.red
plot(hma, "HMA", color = hmaColor, linewidth = 2)Pro tip: Because the HMA reacts fast, many traders pair it with a slower reference (a longer HMA or a standard MA) so the quick line provides timing context while the slow line frames the larger trend — purely as a way to read context, not as an automated signal.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.