Class WmaRTIndicator

All Implemented Interfaces:
Resettable, RTIndicator

public class WmaRTIndicator extends AbstractWindowSeriesRTIndicator
Weighted Moving Average (WMA) with O(1) incremental updates.

Instead of recomputing the full weighted sum on every tick (O(window)), this implementation maintains running weightedSum and plainSum accumulators that are adjusted incrementally when the window rolls.

Algebraic trick when the window is full and a new value enters:

  weightedSum -= plainSum        // shift all weights down by 1
  plainSum    -= evicted          // remove evicted value
  plainSum    += newValue         // add new value
  weightedSum += periods × newValue  // new value enters with max weight

Pro-tier twin of the free WmaRTIndicator (the simple O(window) reference): both produce identical results, this one in O(1) per tick.