Class AbstractDecorableIncrementalRTIndicator

All Implemented Interfaces:
ClockAware, Resettable, RTIndicator
Direct Known Subclasses:
AbstractEmaRTIndicator, AtomicCountRTIndicator, CountRTIndicator, FundingRateRTIndicator, MacdRTIndicator, MaxRTIndicator, MinRTIndicator, OnChangeRTIndicator, PercentChangePeriodRTIndicator, PeriodCounterRTIndicator, RateChangeRTIndicator, RsiRTIndicator, SmaRTIndicator, StochasticRsiRTIndicator, TickerRTIndicator, VarianceRTIndicator

public abstract class AbstractDecorableIncrementalRTIndicator extends AbstractIncrementalRTIndicator implements ClockAware
Incremental indicator that optionally decorates (wraps) another indicator. When a decorated indicator is present, incoming values are first passed through it before being processed by this indicator's incremental logic. This enables chaining, e.g., an SMA wrapping a GainRTIndicator. Propagates clock and reset to the decorated child.
  • Constructor Details

    • AbstractDecorableIncrementalRTIndicator

      public AbstractDecorableIncrementalRTIndicator()
    • AbstractDecorableIncrementalRTIndicator

      public AbstractDecorableIncrementalRTIndicator(int periods)
    • AbstractDecorableIncrementalRTIndicator

      public AbstractDecorableIncrementalRTIndicator(RTIndicator indicator)
    • AbstractDecorableIncrementalRTIndicator

      public AbstractDecorableIncrementalRTIndicator(int periods, RTIndicator indicator)
  • Method Details

    • reset

      public void reset()
      Specified by:
      reset in interface Resettable
      Overrides:
      reset in class AbstractIncrementalRTIndicator
    • getIndicator

      public <T extends RTIndicator> T getIndicator()
    • setClockSupplier

      public void setClockSupplier(Supplier<Clock> clockSupplier)
      Specified by:
      setClockSupplier in interface ClockAware
    • update

      public double update(double newValue)
      Passes the value through the decorated indicator (if present) before feeding the result into this indicator's incremental update pipeline.
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractIncrementalRTIndicator
      Parameters:
      newValue - the raw input value
      Returns:
      the computed value after decoration and incremental processing
    • nextValue

      protected double nextValue(double prevValue, double newValue)
      Description copied from class: AbstractIncrementalRTIndicator
      Computes the next indicator value from the previous and new input values. This is the core calculation method that subclasses must implement.
      Specified by:
      nextValue in class AbstractIncrementalRTIndicator
      Parameters:
      prevValue - the previous indicator value (or last update value, depending on override)
      newValue - the new input value
      Returns:
      the computed indicator value