Returns the Hull moving average, built from weighted averages to cut lag while staying smooth.
ta.hma computes wma(2 * wma(source, length / 2) - wma(source, length), round(sqrt(length))). The first part overshoots toward recent prices and the outer average smooths the result.
The half length is rounded down, with a floor of 1. The first value appears on bar number length + round(sqrt(length)) - 1.
Syntax
ta.hma(source: series int/float, length: simple int) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | Series of values to smooth. |
| length | simple int | required | Main window length. A whole number of 1 or more. |
Returns
series float: the Hull moving average, or na while the nested windows are still filling.
Remarks
- A Hull average turns sooner than
ta.smaandta.emaof the same length but can overshoot after sharp moves.
Example
//@version=6
indicator("Hull MA", overlay = true)
hull = ta.hma(close, 21)
plot(hull, "HMA", color = hull > hull[2] ? color.green : color.red, linewidth = 2)See also
Runs on Sidechair