Class UlcerIndexRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
The Ulcer Index measures downside volatility based on drawdown depth and duration (Peter Martin, 1987). Unlike standard deviation which treats upside and downside equally, UI focuses exclusively on drawdowns:
UI = sqrt(mean(drawdown%²))where
drawdown% = (peak - price) / peak * 100.
Stores prices in a circular buffer. On each tick, recomputes the rolling peak and squared drawdown sum in O(n). This is necessary because evicting the oldest price may remove the peak.
Returns 0 until the window has at least 1 value.
Exposes getMaxDrawdownPercent() for the current window's max
drawdown percentage.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
UlcerIndexRTIndicator
public UlcerIndexRTIndicator(int periods)
-
-
Method Details
-
getPeriods
public int getPeriods() -
isReady
public boolean isReady()Description copied from interface:RTIndicatorReturns 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 returnstrue, the indicator's output is statistically valid.The default implementation returns
truefor 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.
- Returns:
trueif the indicator has completed its warmup period
-
getMaxDrawdownPercent
public double getMaxDrawdownPercent()Returns the maximum drawdown percentage in the current window. -
reset
public void reset()- Specified by:
resetin interfaceResettable- Overrides:
resetin classAbstractRTIndicator
-
update
public double update(double price) - Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-