Class PeriodCounterRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractIncrementalRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractDecorableIncrementalRTIndicator
com.wualabs.qtsurfer.engine.indicators.helpers.PeriodCounterRTIndicator
- All Implemented Interfaces:
ClockAware, PeriodCounter, Resettable, RTIndicator
- Direct Known Subclasses:
GainRTIndicator, LossRTIndicator
public class PeriodCounterRTIndicator
extends AbstractDecorableIncrementalRTIndicator
implements PeriodCounter
Incremental indicator that counts the number of consecutive periods (updates).
Subclasses like GainRTIndicator and LossRTIndicator use this to track how many
consecutive periods a condition has held. The counter increments on each nextValue
call and can be reset via
resetPeriods().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongprotected voidprotected doublenextValue(double prevValue, double newValue) Computes the next indicator value from the previous and new input values.voidMethods inherited from class AbstractDecorableIncrementalRTIndicator
getIndicator, reset, setClockSupplier, updateMethods 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
-
PeriodCounterRTIndicator
-
-
Method Details
-
resetPeriods
public void resetPeriods()- Specified by:
resetPeriodsin interfacePeriodCounter
-
incPeriods
protected void incPeriods() -
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.- Overrides:
nextValuein classAbstractDecorableIncrementalRTIndicator- Parameters:
prevValue- the previous indicator value (or last update value, depending on override)newValue- the new input value- Returns:
- the computed indicator value
-
getPeriodCount
public long getPeriodCount()- Specified by:
getPeriodCountin interfacePeriodCounter
-