Skip to content

Documentation / @finchart/indicators / SmaFold

Interface: SmaFold ​

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

An SMA that folds one step at a time — both the array form (sma) and the tail increment come out of this one. null when the window isn't full yet or has a gap (it never pretends to have a value). The state is the last window (a window ring), and snapshot/restore are the resume checkpoints.

Methods ​

restore() ​

restore(state): void

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

Restores to a checkpoint. Only accepts what snapshot handed out.

Parameters ​

state ​

SumState

Returns ​

void


snapshot() ​

snapshot(): SumState

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

A resume checkpoint — a copy of the internal state.

Returns ​

SumState


step() ​

step(value): number | null

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

Folds the next value and produces the output at that position. null if the window isn't full yet or there's a gap.

Parameters ​

value ​

number | null

Returns ​

number | null