Class MacdRTIndicator
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.momentum.MacdRTIndicator
- All Implemented Interfaces:
ClockAware, Resettable, RTIndicator
MACD RTIndicator
-
Constructor Summary
ConstructorsConstructorDescriptionMacdRTIndicator(RTIndicator indicator) MacdRTIndicator(RTIndicator indicator, int shortEmaPeriods, int longEmaPeriods) -
Method Summary
Methods inherited from class AbstractDecorableIncrementalRTIndicator
getIndicator, nextValue, setClockSupplierMethods inherited from class AbstractIncrementalRTIndicator
getLastUpdateValue, getPeriodCycles, getPeriods, getPrevValue, initValue, isPeriodic, prevNextValue, setPeriods, tickValueMethods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
MacdRTIndicator
public MacdRTIndicator() -
MacdRTIndicator
-
MacdRTIndicator
-
-
Method Details
-
isReady
public boolean isReady()Ready when both EMAs are, which is when the slower of the two is. MACD is the difference of two averages, so it says nothing while either is still warming up.- Specified by:
isReadyin interfaceRTIndicator- Overrides:
isReadyin classAbstractDecorableIncrementalRTIndicator- Returns:
trueif the indicator has completed its warmup period
-
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractDecorableIncrementalRTIndicator
-
update
public double update(double newValue) Computes the MACD line as the difference between the short-period EMA and the long-period EMA. Both EMAs are updated with the same input value, and the difference is passed to the parent incremental pipeline.- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractDecorableIncrementalRTIndicator- Parameters:
newValue- the new input price- Returns:
- the MACD line value (shortEMA - longEMA)
-