Skip to content

Documentation / @finchart/indicators / SumFold

Interface: SumFold ​

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

A windowed sum as a fold — smaFold's ring, summed afresh each step rather than kept as a running total: a running sum subtracts what leaves, and after a 1e20 spike leaves a window of ones it answers 1 for [1, 1, 1] (the ones were rounded away while the spike was inside — measured; smaFold avoids the same flaw the same way). The division is left to the caller (UO and MFI divide one sum by another). Same null rule: null until the window is full or while it holds a gap — and null when the sum of finite inputs leaves the double range or saturates at its largest value (a ratio of two such sums would read NaN; line data is finite or null). O(period) per step by design; the state is just the ring.

Methods ​

restore() ​

restore(state): void

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

Parameters ​

state ​

SumState

Returns ​

void


snapshot() ​

snapshot(): SumState

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

Returns ​

SumState


step() ​

step(value): number | null

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

Parameters ​

value ​

number | null

Returns ​

number | null