Class StreamingIndicators.Sma

java.lang.Object
com.quantfinlib.indicators.StreamingIndicators.Sma
Enclosing class:
StreamingIndicators

public static final class StreamingIndicators.Sma extends Object
Simple moving average over a fixed window; NaN until the window fills. The running sum is recomputed exactly from the window every period updates (amortised O(1)), so add/subtract rounding cannot drift over 10⁸ ticks; the schedule matches the batch Indicators.sma(double[], int) so the two stay bit-identical.
  • Constructor Details

    • Sma

      public Sma(int period)
  • Method Details

    • update

      public double update(double v)
    • value

      public double value()