• Simple moving average. Valid scalar windows without options sum oldest first afresh, then divide once. Missing or overflowing sums produce NaN and recover when they expire. This uses O(n * period) time and O(1) extra working storage. Unsupported scalar periods retain their historical behavior. Supplied skip collects period finite observations and holds across gaps; propagate (also the default for {}) requires a complete chronological window. Warmup is NaN. Option-path periods must be positive safe integers; invalid periods throw RangeError and malformed options throw TypeError.

    Parameters

    Returns number[]

  • Bar-aligned lengths use each current window; NaN lengths give gaps. Arrays default to propagation.

    Parameters

    Returns number[]