Class AbstractEmaRTIndicator
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.core.AbstractEmaRTIndicator
- All Implemented Interfaces:
ClockAware, Resettable, RTIndicator
- Direct Known Subclasses:
EmaRTIndicator, MmaRTIndicator
Base class for EMA RT Indicators
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractEmaRTIndicator(int periods, double alpha, RTIndicator indicator) -
Method Summary
Modifier and TypeMethodDescriptionprotected doublenextValue(double prevValue, double newValue) Computes the exponential moving average using the standard EMA formula:EMA = prevEMA + alpha * (newValue - prevEMA).Methods 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
-
AbstractEmaRTIndicator
-
-
Method Details
-
nextValue
protected double nextValue(double prevValue, double newValue) Computes the exponential moving average using the standard EMA formula:EMA = prevEMA + alpha * (newValue - prevEMA). The alpha (smoothing factor) is set by subclasses (e.g., 2/(periods+1) for EMA, 1/periods for MMA).- Overrides:
nextValuein classAbstractDecorableIncrementalRTIndicator- Parameters:
prevValue- the previous EMA valuenewValue- the new input value- Returns:
- the updated EMA value
-