Docs

ta.hma

Smooth a series with a Hull moving average, which cuts lag.

itm
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.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to read.
lengthConstantnumber-1 to 10000Window in observed bars.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
length + round(sqrt(length)) - 1 bars. 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

itm
ta.hma(close, 20)
itm
plot(ta.hma(close, 20), "Hull 20")