Class AbstractDecorableIncrementalRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractIncrementalRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.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 Summary
ConstructorsConstructorDescriptionAbstractDecorableIncrementalRTIndicator(int periods) AbstractDecorableIncrementalRTIndicator(int periods, RTIndicator indicator) -
Method Summary
Modifier and TypeMethodDescription<T extends RTIndicator>
Tprotected doublenextValue(double prevValue, double newValue) Computes the next indicator value from the previous and new input values.voidreset()voidsetClockSupplier(Supplier<Clock> clockSupplier) doubleupdate(double newValue) Passes the value through the decorated indicator (if present) before feeding the result into this indicator's incremental update pipeline.Methods inherited from class AbstractIncrementalRTIndicator
getLastUpdateValue, getPeriodCycles, getPeriods, getPrevValue, initValue, isPeriodic, isReady, prevNextValue, setPeriods, tickValueMethods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
AbstractDecorableIncrementalRTIndicator
public AbstractDecorableIncrementalRTIndicator() -
AbstractDecorableIncrementalRTIndicator
public AbstractDecorableIncrementalRTIndicator(int periods) -
AbstractDecorableIncrementalRTIndicator
-
AbstractDecorableIncrementalRTIndicator
-
-
Method Details
-
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractIncrementalRTIndicator
-
getIndicator
-
setClockSupplier
- Specified by:
setClockSupplierin interfaceClockAware
-
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:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractIncrementalRTIndicator- 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:AbstractIncrementalRTIndicatorComputes the next indicator value from the previous and new input values. This is the core calculation method that subclasses must implement.- Specified by:
nextValuein classAbstractIncrementalRTIndicator- Parameters:
prevValue- the previous indicator value (or last update value, depending on override)newValue- the new input value- Returns:
- the computed indicator value
-