Class AbstractWindowSeriesRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
- Direct Known Subclasses:
CciRTIndicator, GarmanKlassVolatilityRTIndicator, HurstExponentRTIndicator, InformationRatioRTIndicator, KurtosisRTIndicator, LinearRegressionSlopeRTIndicator, ParkinsonVolatilityRTIndicator, RealizedVolatilityRTIndicator, RogersSatchellVolatilityRTIndicator, SharpeRatioRTIndicator, SimpleLinearRegressionRTIndicator, SkewnessRTIndicator, ValueAtRiskRTIndicator, VarianceRTIndicator, WmaRTIndicator, WmaRTIndicator
WindowSeriesStore.
Provides the common boilerplate: window field, periods field,
getPeriods(), isReady(), and reset().
Subclasses that need to update accumulators when the window evicts the
oldest value should override onEvict(double). Subclasses that
need to zero accumulators on reset should override onReset().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanisReady()Returns whether this indicator has received enough data to produce meaningful values.protected voidonEvict(double evicted) Called when the window evicts the oldest value.protected voidonReset()Called after window is cleared.voidreset()protected WindowSeriesStorewindow()protected intMethods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, update, withDisplayHint, withMeta
-
Constructor Details
-
AbstractWindowSeriesRTIndicator
protected AbstractWindowSeriesRTIndicator(int periods)
-
-
Method Details
-
getPeriods
public int getPeriods() -
isReady
public boolean isReady()Description copied from interface:RTIndicatorReturns whether this indicator has received enough data to produce meaningful values.During the warmup period,
RTIndicator.getValue()may return 0 or a partial estimate that should not be used for trading decisions. Once this method returnstrue, the indicator's output is statistically valid.The default implementation returns
truefor backward compatibility. Indicators with warmup requirements should override this method.For composite indicators (e.g. Bollinger Bands, MACD), readiness is determined by the slowest internal component.
- Returns:
trueif the indicator has completed its warmup period
-
window
-
windowSize
protected int windowSize() -
onEvict
protected void onEvict(double evicted) Called when the window evicts the oldest value. Override to update accumulators. -
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
onReset
protected void onReset()Called after window is cleared. Override to zero accumulators.
-