Class MacdRTIndicator

All Implemented Interfaces:
ClockAware, Resettable, RTIndicator

public class MacdRTIndicator extends AbstractDecorableIncrementalRTIndicator
MACD RTIndicator
  • Constructor Details

    • MacdRTIndicator

      public MacdRTIndicator()
    • MacdRTIndicator

      public MacdRTIndicator(RTIndicator indicator)
    • MacdRTIndicator

      public MacdRTIndicator(RTIndicator indicator, int shortEmaPeriods, int longEmaPeriods)
  • Method Details

    • reset

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

      public double update(double newValue)
      Computes the MACD line as the difference between the short-period EMA and the long-period EMA. Both EMAs are updated with the same input value, and the difference is passed to the parent incremental pipeline.
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractDecorableIncrementalRTIndicator
      Parameters:
      newValue - the new input price
      Returns:
      the MACD line value (shortEMA - longEMA)