ta.hma
Smooth a series with a Hull moving average, which cuts lag.
ta.hma(source, length)Hull moving average: wma(2*wma(source, floor(length/2)) - wma(source, length), round(sqrt(length))). Both inner lengths are floored at 1, so a length of 1 or 2 degenerates rather than erroring.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | The series to read. |
length | Constant | number | - | 1 to 10000 | Window in observed bars. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
length + round(sqrt(length)) - 1bars. Names in the warm-up are this operator’s parameters.- Missing values
- na until the two inner weighted averages and the outer one have all warmed up: length + round(sqrt(length)) - 1 observations. An na resets the accumulation.
Example
ta.hma(close, 20)plot(ta.hma(close, 20), "Hull 20")