Class AlmaRTIndicator

java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.averages.pro.AlmaRTIndicator
All Implemented Interfaces:
Resettable, RTIndicator

public class AlmaRTIndicator extends AbstractRTIndicator
Arnaud Legoux Moving Average (ALMA) with O(n) per-tick computation.

Gaussian-weighted moving average that balances smoothness and responsiveness. i indexes the window oldest (0) to newest (periods-1), matching offset:

  w[i] = exp(-((i - offset)^2) / (2 * sigma^2))
  ALMA = sum(w[i] * price[i]) / sum(w[i])

Default parameters: offset factor = 0.85, sigma factor = 6 — with the default offset, offset sits near periods-1 (the newest sample), which is what gives ALMA its low lag versus a plain centered Gaussian-weighted average.

  • Constructor Details

    • AlmaRTIndicator

      public AlmaRTIndicator(int periods)
    • AlmaRTIndicator

      public AlmaRTIndicator(int periods, double offsetFactor, double sigmaFactor)
  • Method Details

    • getPeriods

      public int getPeriods()
    • isReady

      public boolean isReady()
      Description copied from interface: RTIndicator
      Returns whether this indicator has received enough data to produce meaningful values.

      During the warmup period, RTIndicator.getValue() may return 0 or a partial estimate that should not be used for trading decisions. Once this method returns true, the indicator's output is statistically valid.

      The default implementation returns true for backward compatibility. Indicators with warmup requirements should override this method.

      For composite indicators (e.g. Bollinger Bands, MACD), readiness is determined by the slowest internal component.

      Returns:
      true if the indicator has completed its warmup period
    • reset

      public void reset()
      Specified by:
      reset in interface Resettable
      Overrides:
      reset in class AbstractRTIndicator
    • update

      public double update(double newValue)
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractRTIndicator