Class OmegaRatioRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
The Omega Ratio is a probability-weighted ratio of gains versus losses relative to a threshold (default 0). Unlike the Sharpe Ratio, it captures the entire return distribution, not just the first two moments.
Omega = sumGains / sumLosseswhere:
sumGains = Σ max(r_i - threshold, 0)sumLosses = Σ max(threshold - r_i, 0)
Maintains two parallel WindowSeriesStore instances storing
gain and loss contributions with separate accumulators (sumGains,
sumLosses). The first tick establishes the initial price.
Returns 0 when there are no losses. An Omega > 1 indicates more probability-weighted gains than losses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoubleReturns the sum of gains above the threshold in the current window.doubleReturns the sum of losses below the threshold in the current window.booleanisReady()Returns whether this indicator has received enough data to produce meaningful values.voidreset()doubleupdate(double price) withThreshold(double threshold) Sets the threshold for gain/loss classification.Methods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
OmegaRatioRTIndicator
public OmegaRatioRTIndicator(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
-
withThreshold
Sets the threshold for gain/loss classification. Default is 0.Returns above this threshold count as gains; below as losses.
-
getSumGains
public double getSumGains()Returns the sum of gains above the threshold in the current window. -
getSumLosses
public double getSumLosses()Returns the sum of losses below the threshold 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
-