Skip to content

SMA (Simple Moving Average)

Simple moving average of an upstream series. This is an edge-first, chainable transform: it consumes the series produced by the connected upstream node, so you can chain price_factor → SMA → Crossover. When nothing is wired in, it falls back to fetching the series for symbol. Wired to more than one Price Factor, it fans out to per-ticker by_symbol results.

What (One-liner)

Rolling mean of an upstream series (default window 20) — the basic smoothing primitive that feeds MACD, Bollinger, and momentum chains.

Inputs

  • window (number, optional) — rolling window, default 20.
  • symbol (string, optional) — fallback ticker used only when there is no upstream series.

Outputs

  • series — SMA series aligned to the input (warmup values are None).
  • current — latest SMA value.
  • by_symbol — per-ticker map when fed by multiple Price Factors.

How to use

  1. Connect an upstream price_factor (or another transform).
  2. Set window (default 20).
  3. Output series chains into the next transform.

Core formulas

sma_t = series.rolling(window=window).mean()[t]

Assumptions & applicability

Assumptions: equidistant timestamps + ordered numeric series + window ≥ 2.

Applicability: price smoothing, MACD components, golden/death-cross strategies; any asset class, any frequency.

Out of scope: weighted MA / EMA (use compute_ema_v1), adaptive window.

Known limitations

  1. Equal-weight window lags trend turns (slower than EMA).
  2. Left-aligned warmup (first window-1 points are None).
  3. Does not handle calendar gaps.

References

Murphy (1999), Technical Analysis of the Financial Markets.

Golden Test

tests/golden/fixtures/tier1/compute_sma/ — tolerance 1e-12 absolute, benchmarked against pandas.Series.rolling().mean(), last verified 2026-05-25, status passing.

Changelog

  • 1.0.0 (2026-05-25) — Activated as canonical Layer-1 transform; merged governance fields from the superseded Layer-0 compute_sma card.

Verifiable intelligence for the decisions that demand scrutiny.