Class ComplexConvergenceDivergence

java.lang.Object
trade.invision.indicators.indicators.Indicator<Boolean>
trade.invision.indicators.indicators.convergencedivergence.ComplexConvergenceDivergence

public class ComplexConvergenceDivergence extends Indicator<Boolean>
ComplexConvergenceDivergence is a Boolean Indicator to test whether two Num Indicators converge or diverge over a length of values. "Complex" convergence-divergence uses an advanced evaluation technique that tests if the correlation (using the correlation coefficient) and the slope (using the linear regression model) of values in a timeframe that align with the given convergence-divergence type are above the given thresholds. This requires more computational power than the "simple" convergence-divergence technique. Internally, this uses the CorrelationCoefficient and the LinearRegression.
See Also:
  • Constructor Details

  • Method Details

    • complexConvergenceDivergence

      public static ComplexConvergenceDivergence complexConvergenceDivergence(Indicator<Num> first, Indicator<Num> second, ConvergenceDivergenceType type, int length, Num correlationThreshold, Num slopeThreshold, boolean unbiased)
      Parameters:
      first - the first Indicator
      second - the second Indicator
      type - the ConvergenceDivergenceType
      length - the number of values to look back at
      correlationThreshold - the correlation threshold. Must be between zero and one. Zero to disable.
      slopeThreshold - the slope threshold. Must be between zero and one. Zero to disable.
      unbiased - true to use n - 1 (unbiased) for the divisor in the correlation coefficient calculation, false to use n (biased)
    • calculate

      protected Boolean calculate(long index)
      Description copied from class: Indicator
      Performs the calculation of this Indicator at the given index.
      Specified by:
      calculate in class Indicator<Boolean>
      Parameters:
      index - the index
      Returns:
      the result (never null)