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

public class RogersSatchellVolatilityRTIndicator extends AbstractWindowSeriesRTIndicator
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 Details

    • RogersSatchellVolatilityRTIndicator

      public RogersSatchellVolatilityRTIndicator(int periods)
  • Method Details

    • onEvict

      protected void onEvict(double evicted)
      Description copied from class: AbstractWindowSeriesRTIndicator
      Called when the window evicts the oldest value. Override to update accumulators.
      Overrides:
      onEvict in class AbstractWindowSeriesRTIndicator
    • onReset

      protected void onReset()
      Description copied from class: AbstractWindowSeriesRTIndicator
      Called after window is cleared. Override to zero accumulators.
      Overrides:
      onReset in class AbstractWindowSeriesRTIndicator
    • withAnnualizationFactor

      public RogersSatchellVolatilityRTIndicator withAnnualizationFactor(double factor)
      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. Use update(double, double, double, double).
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractRTIndicator
      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.