Class HurstExponentRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractWindowSeriesRTIndicator
com.wualabs.qtsurfer.engine.indicators.statistics.pro.HurstExponentRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Rolling Hurst Exponent with O(n) per-tick updates.
Estimates the Hurst exponent using the Rescaled Range (R/S) method over a rolling window of log returns. The Hurst exponent indicates:
H < 0.5— mean-reverting (anti-persistent)H = 0.5— random walkH > 0.5— trending (persistent)
The R/S statistic for a series of n returns is:
R/S = range(cumulative deviations from mean) / stddevThen
H = log(R/S) / log(n).
Note: Unlike most indicators in this module, the Hurst exponent requires O(n) per tick because computing the range of cumulative deviations cannot be maintained incrementally. The rolling window stores returns; on each tick the R/S is recomputed from the window contents.
Maintains a window for log returns plus dual
accumulators (sumR, sumRSq) for mean and stddev.
Returns 0.5 when stddev is zero or window is not full.
-
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
-
HurstExponentRTIndicator
public HurstExponentRTIndicator(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
-
update
public double update(double price) - Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator
-