Class MaxDrawdownRTIndicator

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

public class MaxDrawdownRTIndicator extends AbstractRTIndicator
Rolling Maximum Drawdown with O(1) per-tick updates.

Tracks the largest peak-to-trough decline over the life of the indicator. The drawdown at any point is defined as:

  DD_t = (peak - price_t) / peak
and the maximum drawdown is the largest DD observed so far.

The value is always non-negative (0 = no drawdown, 1 = 100% loss). Maintains only two state variables: peak and maxDrawdown.

Exposes getCurrentDrawdown() for the current (not necessarily maximum) drawdown and getPeak() for the running high-water mark.

  • Constructor Details

    • MaxDrawdownRTIndicator

      public MaxDrawdownRTIndicator()
  • Method Details

    • isReady

      public boolean isReady()
      Returns the peak (high-water mark) price observed so far.
      Returns:
      true if the indicator has completed its warmup period
    • getPeak

      public double getPeak()
    • getCurrentDrawdown

      public double getCurrentDrawdown()
      Returns the current drawdown from the peak (not the max).
    • update

      public double update(double price)
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractRTIndicator
    • reset

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