Skip to content

Documentation / @finchart/indicators / smaFold

Function: smaFold() ​

smaFold(period): SmaFold

Defined in: indicators/src/kernels.ts:42

The window mean is the window sum over the period — sumFold's ring, summed afresh each step. It used to keep a running total that subtracted what left the window, and that total carried two flaws no order of operations fixes: the residual a departing outlier leaves behind ([1e20, 1, 1, 1] over 3 answered 1/3 — the ones were rounded away while the spike was inside — where the window's mean is 1), and a sum that finite inputs pushed past the double range stayed Infinity for good. Recomputing costs O(period) per step; the state is just the ring.

Parameters ​

period ​

number

Returns ​

SmaFold