Skip to content

HMA #

HMA #

HMA(
    period: int,
    input_values: List[float] = None,
    input_indicator: Indicator = None,
    input_modifier: InputModifierType = None,
    input_sampling: SamplingPeriodType = None,
)

Bases: Indicator

Hull Moving Average.

Input type: float

Output type: float

Parameters:

Name Type Description Default
period int

Period.

required
input_values List[float]

List of input values.

None
input_indicator Indicator

Input indicator.

None
input_modifier InputModifierType

Input modifier.

None
input_sampling SamplingPeriodType

Input sampling type.

None
Source code in talipp/indicators/HMA.py
def __init__(self, period: int,
             input_values: List[float] = None,
             input_indicator: Indicator = None,
             input_modifier: InputModifierType = None,
             input_sampling: SamplingPeriodType = None):
    super().__init__(input_modifier=input_modifier,
                     input_sampling=input_sampling)

    self.period = period

    self.wma = WMA(period)
    self.wma2 = WMA(int(period / 2))
    self.hma = WMA(int(sqrt(period)))

    self.add_sub_indicator(self.wma)
    self.add_sub_indicator(self.wma2)
    self.add_managed_sequence(self.hma)

    self.initialize(input_values, input_indicator)