sma

forge.tafunctionSince Forge API 1
Functionpython
forge.ta.sma(source: ArrayLike, period: int = 20) -> np.ndarray

Mean of the last period values, each window summed from scratch.

Parameters

NameTypeDefault
sourceArrayLike
periodint20

Indicator: Simple moving average

NaN until period bars exist, and for any window that holds a missing value.

Classpython
forge.ta.SMA(**inputs: Any) -> None

Average of the last N values, each weighted equally.

Inputs

NameTypeDefaultRange
sourcesourceclose
periodint201 to 5000

SMA[i] = (x[i] + x[i-1] + ... + x[i-period+1]) / period

No value until period bars exist. A window holding a missing value has no value.

Used in