Simple Moving Average (SMA)

StratCraft indicator page for SMA.

Route: /indicators/sma/

What It Does

SMA is the simplest moving average. It smooths price by averaging the last n observations equally.

Formula

SMA = (P1 + P2 + ... + Pn) / n

Parameters

  • period - default 30

C++23 API

#include <nonabt/indicators/sma.hpp>
auto sma = std::make_unique<nonabt::SMA>(data().close(), 30);

Common Usage

  • Use SMA as a baseline trend line.
  • Use SMA crossovers for simple trend systems.
  • Use SMA as the center line for channel indicators.

Practical Pattern

SMA is slower than EMA but often cleaner for longer-horizon trend confirmation.