How it is calculated
Two WMAs of the source, one over half the length (rounded down), one over the full length. Twice the short one minus the long one cancels most of the lag, and that difference is smoothed again with a WMA over the square root of the length, rounded down. The first value needs length plus that root minus 1 bars.
Reference: Hull 2005
How to read it
The direction of the line is the main reading: a turn shows a change of trend early. Because it removes lag by extrapolating, it overshoots at sharp turns and can run past price; in a sideways market it turns often.
In a strategy
The slope as trend signal: compare ctx.ind("hma", length=21) with its value a bar earlier and hold longs while it rises.
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
Lengthlength | Whole number | 9 | min 2, max 5000 |
Sourcesource | Price | "close" | close, open, high, low, hl2, hlc3, ohlc4, hlcc4 |
What it draws
| Line | Drawn as |
|---|---|
| HMA | Line |
Used in
No strategy template reads it yet.