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 TypeMethodDescriptiondoubleupdate(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, reset, 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
-
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
-