Class DistanceFromMaRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.distance.DistanceFromMaRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Distance From Moving Average (value - MA)/MA
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisReady()Ready when the moving average is: the distance has nothing to wait for but the average.voidreset()Returns the moving average it updates to its pre-first-update state, as a holder does.doubleupdate(double newValue) Computes the fractional distance of the current price from its moving average: (price - MA) / MA.Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Field Details
-
ID
Canonical catalog id, set as an explicit IndicatorMeta.ID override where getId() class-name derivation would be wrong.- See Also:
-
-
Constructor Details
-
DistanceFromMaRTIndicator
-
-
Method Details
-
isReady
public boolean isReady()Ready when the moving average is: the distance has nothing to wait for but the average.- Returns:
trueif the indicator has completed its warmup period
-
reset
public void reset()Returns the moving average it updates to its pre-first-update state, as a holder does.- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
update
public double update(double newValue) Computes the fractional distance of the current price from its moving average: (price - MA) / MA. Returns 0 when the MA is zero to avoid division by zero. Positive values indicate price above the MA; negative values indicate below.- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator- Parameters:
newValue- the current price- Returns:
- the fractional distance from the moving average
-