Class RogersSatchellVolatilityRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractWindowSeriesRTIndicator
com.wualabs.qtsurfer.engine.indicators.statistics.pro.volatility.RogersSatchellVolatilityRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Rogers-Satchell Volatility estimator with O(1) per-tick updates.
Uses the full OHLC bar to estimate volatility without assuming zero drift, making it more accurate than Parkinson and Garman-Klass for trending markets. Rogers & Satchell (1991) showed this estimator is unbiased regardless of the drift (mean return) of the underlying process.
The Rogers-Satchell variance for each bar is:
RS_i = ln(H_i / C_i) * ln(H_i / O_i) + ln(L_i / C_i) * ln(L_i / O_i)
The rolling estimator averages over n bars:
σ² = (1/n) * Σ RS_i
Maintains a single accumulator (sumRS) over a
window storing per-bar RS values.
On eviction the accumulator is decremented.
Annualization is supported via withAnnualizationFactor(double).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the current Rogers-Satchell variance (squared volatility, before annualization).protected voidonEvict(double evicted) Called when the window evicts the oldest value.protected voidonReset()Called after window is cleared.doubleupdate(double newValue) Not supported — Rogers-Satchell requires OHLC inputs.doubleupdate(double open, double high, double low, double close) Updates the indicator with a new OHLC bar and returns the current Rogers-Satchell volatility.withAnnualizationFactor(double factor) Sets the annualization factor.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
-
RogersSatchellVolatilityRTIndicator
public RogersSatchellVolatilityRTIndicator(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
-
withAnnualizationFactor
Sets the annualization factor. The output is multiplied by this factor.Common values:
Math.sqrt(252)— daily bars (trading days/year)Math.sqrt(365)— daily bars (calendar days/year)
-
getRogersSatchellVariance
public double getRogersSatchellVariance()Returns the current Rogers-Satchell variance (squared volatility, before annualization). -
update
public double update(double newValue) Not supported — Rogers-Satchell requires OHLC inputs. Useupdate(double, double, double, double).- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator- Throws:
UnsupportedOperationException- always
-
update
public double update(double open, double high, double low, double close) Updates the indicator with a new OHLC bar and returns the current Rogers-Satchell volatility.
-