Class VarianceRTIndicator

All Implemented Interfaces:
Resettable, RTIndicator

public class VarianceRTIndicator extends AbstractWindowSeriesRTIndicator
Rolling variance with O(1) per-tick updates using a single window.

Maintains dual accumulators (sum and sumSq) over a single window. On eviction both accumulators are decremented, eliminating the need for a separate SMA object and its duplicate window.

Variance is computed via the algebraic identity:

  Var(X) = E(X²) - E(X)²  =  sumSq/n - (sum/n)²

Population variance by default (standard for trading indicators). Use withSampleVariance(boolean) to enable Bessel's correction.

Produces identical results to VarianceRTIndicator (when both use the same variance type) with a single window instead of two.