Class GarmanKlassVolatilityRTIndicator

All Implemented Interfaces:
Resettable, RTIndicator

public class GarmanKlassVolatilityRTIndicator extends AbstractWindowSeriesRTIndicator
Garman-Klass Volatility estimator with O(1) per-tick updates.

Uses the full OHLC bar to estimate volatility, incorporating both the high-low range and the open-close movement. Garman & Klass (1980) showed this estimator is ~7.4x more efficient than the classical close-to-close estimator, and more efficient than Parkinson's range-based estimator because it also captures overnight drift.

The Garman-Klass variance for each bar is:

  GK_i = 0.5 * ln(H_i / L_i)² - (2 * ln(2) - 1) * ln(C_i / O_i)²

The rolling estimator averages over n bars:

  σ² = (1/n) * Σ GK_i

Maintains a single accumulator (sumGK) over a window storing per-bar GK values. On eviction the accumulator is decremented.

Annualization is supported via withAnnualizationFactor(double).

  • Constructor Details

    • GarmanKlassVolatilityRTIndicator

      public GarmanKlassVolatilityRTIndicator(int periods)
  • Method Details