← Back to Home
Trading Signal / Indicator
🌊

Hull Moving Average (HMA)

A fast, smooth moving average that nearly eliminates lag.

Start Automating Free →

Want to automate this strategy? Try auto-Trading free — no credit card required.

Hull Moving Average (HMA) chart

Overview

What is Hull Moving Average (HMA)?

The Hull Moving Average (HMA), created by Alan Hull in 2005, is designed to address the fundamental flaw of all traditional moving averages: lag. Standard SMAs and EMAs are inherently backward-looking, causing entries and exits to occur well after trends have already begun. The HMA dramatically reduces this lag while maintaining a smooth output line.

The formula is: HMA(n) = WMA(2 × WMA(n/2) − WMA(n), sqrt(n)), where WMA is a Weighted Moving Average. By computing the WMA of half the period, doubling it, subtracting the full-period WMA, and then taking the WMA of the square root of the period on the result, Hull created an average that can actually anticipate trends rather than just follow them.

The key difference is visual: while an SMA or EMA turns after the price has already moved, the HMA begins turning at or sometimes before the price reversal. This makes the HMA more suitable for entries and exits than traditional MAs, particularly for swing and intraday traders who prioritise speed.

The HMA also stays smooth even with shorter periods — a 9-period HMA tracks price closely without the noise of a 9-period SMA or EMA. This makes it excellent for identifying momentum shifts at pivotal price levels. Color-coded HMAs (green when rising, red when falling) provide instant visual trend context.

How It Works in auto-Trading

Automate It

auto-Trading implements the Hull Moving Average for any period and price source. Strategy triggers include: HMA direction changes (rising to falling or vice versa), price crossing the HMA, and HMA crossovers with other moving averages. The HMA is particularly effective as a dynamic stop-loss reference — stops placed at the current HMA value trail the trend cleanly.

Try Free →

Strategy Code

Pick a script below, copy it, and use it on your chart.

Pine Script (TradingView)

This is a TradingView Pine Script example for this indicator. Paste it into the TradingView Pine Editor, add it to your chart, and adjust inputs for your market and timeframe.

//@version=6
strategy("Hull Moving Average (HMA)", overlay=true)
fastLen = input.int(20, "Fast Length")
slowLen = input.int(50, "Slow Length")
fast = ta.ema(close, fastLen)

Get full strategy code access

Enter your email address and full name to unlock this strategy code.

ThinkScript (thinkorswim)

This is a thinkorswim ThinkScript example for this indicator. Open thinkorswim, create a custom study, paste the script, and apply it to your chart.

input length = 21;
def hma = HullMovingAvg(close, length);
def buySignal = close crosses above hma;
def sellSignal = close crosses below hma;
AddOrder(OrderType.BUY_AUTO, buySignal, close, 1, Color.GREEN, Color.GREEN, "HMA Buy");

Get full strategy code access

Enter your email address and full name to unlock this strategy code.

Ready to automate Hull Moving Average (HMA)?

Join thousands of traders who use auto-Trading to execute this strategy automatically, 24/7.

Get Started Free →

All Strategies & Signals

Continue Learning

Trading Strategies

Trading Signals & Indicators