Skip to content

ALMA #

ALMA #

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

Bases: Indicator

Arnaud Legoux Moving Average.

Input type: float

Output type: float

Parameters:

Name Type Description Default
period int

Moving average period.

required
offset float

Weights offset.

required
sigma float

Weights sigma factor.

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/ALMA.py
def __init__(self, period: int,
             offset: float,
             sigma: float,
             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.offset = offset
    self.sigma = sigma

    # calculate weights and normalisation factor (w_sum)
    self.w = []
    self.w_sum = 0.0
    s = self.period / float(self.sigma)
    m = (self.period - 1) * self.offset
    for i in range(0, self.period):
        self.w.append(exp(-1 * (i - m) * (i - m) / (2 * s * s)))
        self.w_sum += self.w[-1]

    self.initialize(input_values, input_indicator)