Class DistanceFromMaRTIndicator

java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.distance.DistanceFromMaRTIndicator
All Implemented Interfaces:
Resettable, RTIndicator

public class DistanceFromMaRTIndicator extends AbstractRTIndicator
Distance From Moving Average (value - MA)/MA
See Also:
  • Field Details

    • ID

      public static final String ID
      Canonical catalog id, set as an explicit IndicatorMeta.ID override where getId() class-name derivation would be wrong.
      See Also:
  • Constructor Details

    • DistanceFromMaRTIndicator

      public DistanceFromMaRTIndicator(@NonNull @NonNull RTIndicator maIndicator)
  • 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:
      update in interface RTIndicator
      Overrides:
      update in class AbstractRTIndicator
      Parameters:
      newValue - the current price
      Returns:
      the fractional distance from the moving average