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
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) / peakand 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 Summary
Constructors -
Method Summary
Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
MaxDrawdownRTIndicator
public MaxDrawdownRTIndicator()
-
-
Method Details
-
isReady
public boolean isReady()Returns the peak (high-water mark) price observed so far.- Returns:
trueif 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:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-