Class AbstractEmaRTIndicator

All Implemented Interfaces:
ClockAware, Resettable, RTIndicator
Direct Known Subclasses:
EmaRTIndicator, MmaRTIndicator

public abstract class AbstractEmaRTIndicator extends AbstractDecorableIncrementalRTIndicator
Base class for EMA RT Indicators
  • Constructor Details

    • AbstractEmaRTIndicator

      protected AbstractEmaRTIndicator(int periods, double alpha, RTIndicator indicator)
  • Method Details

    • nextValue

      protected double nextValue(double prevValue, double newValue)
      Computes the exponential moving average using the standard EMA formula: EMA = prevEMA + alpha * (newValue - prevEMA). The alpha (smoothing factor) is set by subclasses (e.g., 2/(periods+1) for EMA, 1/periods for MMA).
      Overrides:
      nextValue in class AbstractDecorableIncrementalRTIndicator
      Parameters:
      prevValue - the previous EMA value
      newValue - the new input value
      Returns:
      the updated EMA value