Class StandardDeviationRTIndicator

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

public class StandardDeviationRTIndicator extends AbstractRTIndicator
Std Deviation RT Indicator
  • Constructor Details

    • StandardDeviationRTIndicator

      public StandardDeviationRTIndicator()
    • StandardDeviationRTIndicator

      public StandardDeviationRTIndicator(int periods)
    • StandardDeviationRTIndicator

      public StandardDeviationRTIndicator(RTIndicator indicator, int periods)
  • Method Details

    • isReady

      public boolean isReady()
      Description copied from interface: RTIndicator
      Returns whether this indicator has received enough data to produce meaningful values.

      During the warmup period, RTIndicator.getValue() may return 0 or a partial estimate that should not be used for trading decisions. Once this method returns true, the indicator's output is statistically valid.

      The default implementation returns true for backward compatibility. Indicators with warmup requirements should override this method.

      For composite indicators (e.g. Bollinger Bands, MACD), readiness is determined by the slowest internal component.

      An indicator derived from other indicators (a distance between two of them, a function of one, a view of a parent's band) is ready when all the indicators it reads are ready, plus its own warm-up if it has one. It must not report ready from the first point while its sources are still warming up, and resetting it returns the indicators it updates to their start.

      Returns:
      true if the indicator has completed its warmup period
    • reset

      public void reset()
      Specified by:
      reset in interface Resettable
      Overrides:
      reset in class AbstractRTIndicator
    • withAverageSample

      public StandardDeviationRTIndicator withAverageSample(boolean averageSample)
    • withPrecision

      public StandardDeviationRTIndicator withPrecision(VariancePrecision precision)
      Chooses how the variance behind the deviation is worked out: VariancePrecision.EXACT (the default) or the O(1) VariancePrecision.FAST.
    • getPrecision

      public VariancePrecision getPrecision()
    • update

      public double update(double newValue)
      Computes the standard deviation as the square root of the variance. Clamps negative variance to zero to guard against catastrophic cancellation in floating-point arithmetic.
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractRTIndicator
      Parameters:
      newValue - the new input value
      Returns:
      the standard deviation (non-negative)
    • getVariance

      public VarianceRTIndicator getVariance()