Class SkewnessRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractWindowSeriesRTIndicator
com.wualabs.qtsurfer.engine.indicators.statistics.pro.SkewnessRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Rolling Skewness with O(1) per-tick updates.
Measures the asymmetry of the distribution of values in the rolling window. Positive skewness indicates a right tail; negative indicates a left tail. Commonly used to detect asymmetry in return distributions.
Uses the sample (adjusted) skewness formula:
g₁ = [n / ((n-1)(n-2))] * Σ((x_i - x̄) / s)³which can be computed from three power-sum accumulators (
sum,
sumSq, sumCub) via:
m₂ = sumSq/n - mean² m₃ = sumCub/n - 3*mean*sumSq/n + 2*mean³ skew = (n² * m₃) / ((n-1)(n-2) * m₂^1.5)
Returns 0 when n < 3 or when standard deviation is zero.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractWindowSeriesRTIndicator
getPeriods, isReady, reset, window, windowSizeMethods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
SkewnessRTIndicator
public SkewnessRTIndicator(int periods)
-
-
Method Details
-
onEvict
protected void onEvict(double evicted) Description copied from class:AbstractWindowSeriesRTIndicatorCalled when the window evicts the oldest value. Override to update accumulators.- Overrides:
onEvictin classAbstractWindowSeriesRTIndicator
-
onReset
protected void onReset()Description copied from class:AbstractWindowSeriesRTIndicatorCalled after window is cleared. Override to zero accumulators.- Overrides:
onResetin classAbstractWindowSeriesRTIndicator
-
getMean
public double getMean()Returns the current rolling mean. -
update
public double update(double newValue) - Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-