A moving average that's both fast and smooth — properties the EMA, DEMA, and TEMA family trade off against each other. HMA achieves this by combining three weighted moving averages of different lengths into a single curve.
HMA(14) vs EMA(14) on MES 5m — through a trend reversal
What it measures
- Trend direction with both reduced lag and smoothness. Unlike TEMA, HMA stays smooth even at short periods.
- Curve quality. The resulting line has a flowing shape that follows price closely without bar-by-bar noise.
- Slope direction changes early. Often the cleanest "trend turned" signal in the moving-average family.
Formula
How AlgoLift computes it
HMA(n) = WMA(2 × WMA(price, n/2) − WMA(price, n), √n)
Three weighted moving averages stacked: a half-period WMA, a full-period WMA, their weighted difference, then a final WMA over the square root of the period to smooth the result.
The half-period WMA captures recent direction quickly. Subtracting the full-period WMA cancels the lag introduced by smoothing. The final square-root-period WMA filters out the noise that the cancellation amplifies. Net result: fast and smooth, which sounds impossible until you see the curve.
Developed by Alan Hull in 2005.
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Period | 14 | 2–500 | Lookback in bars. Common periods are 9, 14, 21, 50. |
Recommended periods
- 9 (fast): Short-term scalping. Smooth enough to be readable, fast enough to catch quick moves.
- 14 (default): Intraday day-trading.
- 21–34 (medium): Swing-trade entries. HMA's smoothness becomes more valuable at slightly longer periods.
- 50+: Long-term reference. At this length most users prefer SMA or EMA — HMA's complexity stops paying off.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| HMA | Numeric | Always | The HMA line. The flowing curve is the indicator's signature. |
| Slope | Numeric | On select | Bar-over-bar change. The cleanest slope output of any moving average — sharp changes here often precede price turns. |
HMA node — default state
How to read it
- Price above HMA: Up-state with strong confirmation.
- Price below HMA: Down-state with strong confirmation.
- HMA slope changes color/direction: The cleanest reversal signal available from a moving average. Many strategies color the HMA line based on slope direction for instant visual feedback.
- HMA flattening: The line losing slope (without flipping) often indicates loss of momentum before a reversal.
HMA is the moving average to reach for when you need both responsiveness and a clean line. The slope output is the most useful in the moving-average family — sharp slope flips precede price turns more reliably than EMA or DEMA equivalents.
Best in / worst in
Best in mid-frequency intraday strategies (5m–30m bars), swing setups, and anywhere a visually clean trend line aids strategy logic. The slope output is especially valuable.
Worst in very-low-timeframe scalping (sub-1m bars) where TEMA's additional speed matters more than HMA's smoothness, and in markets dominated by sharp news-driven gaps — HMA's smoothing can mask the gap until well after the move.
Three setups
1. HMA slope-based regime filter
The single cleanest use of HMA. Use the slope output as a binary regime flag.
- Long-only mode: HMA(21) slope > 0 — strategy permitted to take longs only.
- Short-only mode: HMA(21) slope < 0 — strategy permitted to take shorts only.
- Flat: HMA(21) slope within ±0.1 of zero — strategy paused.
The clean slope means fewer regime flips than with EMA-based equivalents.
HMA slope as a regime gate
2. HMA reversal entry
Trade the slope flip directly.
- Long: HMA(14) slope was ≤ 0 for 3+ bars AND just crossed to > 0.
- Short: Symmetric.
Cleaner than a TEMA equivalent and earlier than an EMA equivalent.
3. HMA pullback to slow EMA
Use HMA on the entry timeframe and a slower EMA as the pullback target.
- Long: HMA(14) slope > 0 (uptrend) AND price touches EMA(50) AND HMA(14) > EMA(50).
- Short: Symmetric.
The HMA confirms the trend; the EMA defines the pullback level.
Advanced patterns in AlgoLift
HMA slope for trailing stop logic. Wire HMA's Slope output into a comparison: once slope crosses zero against your position, close the trade via Set Exit Condition. Acts as a momentum-based trailing exit that doesn't require ATR tuning. Combine with a hard stop loss as a safety floor.
HMA on entry timeframe, SMA(200) on regime timeframe. Standard execution-vs-regime split — HMA for the fast entries, SMA(200) on a higher timeframe for the regime kill-switch. Wire both as separate data series in the Visual Builder.
HMA as the basis for a Cluster. HMA + slope-based exit + ATR-based stop is a compact 5-node strategy that works across many instruments. Save it as a Cluster once.
Common mistakes
- Treating HMA as universally better than EMA. It's better at one specific task — extracting a clean slope signal from short periods. For long-period regime filters, plain SMA is more stable. For sub-1-minute scalping, TEMA reacts faster.
- Plotting HMA without using the slope. The line itself is similar to other moving averages. The slope is the unique value-add — strategies that ignore it leave the main feature unused.
- Combining HMA with itself at different periods. HMA(9) crossing HMA(21) is plausible but rarely outperforms an HMA + EMA pair at the same lengths. The constructions are similar enough that the crossovers fire on the same noise.