Enum Class VariancePrecision

java.lang.Object
java.lang.Enum<VariancePrecision>
com.wualabs.qtsurfer.engine.indicators.statistics.VariancePrecision
All Implemented Interfaces:
Serializable, Comparable<VariancePrecision>, Constable

public enum VariancePrecision extends Enum<VariancePrecision>
How VarianceRTIndicator (and so StandardDeviationRTIndicator and the Bollinger bands) works the variance out.

Both give the variance of the window; they differ in cost and in the last digits.

  • Enum Constant Details

    • EXACT

      public static final VariancePrecision EXACT
      The default. The mean first, then the squared deviations from it, from the window on every tick: O(periods) per tick, exact to the last digits, nothing to drift, and the same digits in every engine.
    • FAST

      public static final VariancePrecision FAST
      O(1) per tick. Keeps running sums of the deviations from a reference value near the mean of the window, together with a worst-case bound on the rounding each sum has gathered, and works the window out again (an EXACT pass, rare in practice) as soon as that bound could cost more than one part in a thousand million of the variance. So the rounding stays below about 1e-9 of the variance wherever the mean is (the tests hold the result to ten times that), it does not lose the width of the bands in a quiet market the way a plain running sum of squares does, and the cost does not grow with the periods. It is not bit-for-bit the exact result, and a nearly flat window may take the exact pass on every tick.
  • Method Details

    • values

      public static VariancePrecision[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static VariancePrecision valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null