Skip to content

Indicator Formula

Technical Details — Simple Moving Average (SMA)

Section titled “Technical Details — Simple Moving Average (SMA)”

The Simple Moving Average (SMA) calculates the unweighted arithmetic mean of closing prices over a specified lookback period. This straightforward approach — summing all closes and dividing by the count — produces the smoothest moving average but with the most lag.


Mathematical Derivation

Purpose: Sum all closing prices in the lookback window.

$$Sum[t] = \sum_{i=0}^{n-1} Close[t-i]$$

Where:

  • $$Close[t]$$ = Closing price at period t
  • $$n$$ = Lookback period

What This Measures: The total price over the window


Purpose: Calculate the arithmetic mean.

$$SMA[t] = \frac{Sum[t]}{n}$$

Where:

  • $$n$$ = Number of bars in the period

What This Measures: The equally-weighted average price over n bars



Compact Formula Summary

$$SMA[t] = \frac{\sum_{i=0}^{n-1} Close[t-i]}{n}$$

Default Parameter: Period (n) = 14


Complete Calculation Example

With Period = 5 and closes [44, 44.25, 44.50, 44.75, 45.00]:

$$SMA = \frac{44 + 44.25 + 44.50 + 44.75 + 45.00}{5} = \frac{222.50}{5} = 44.50$$


Key Takeaways from the Example
  1. Simplest MA: Just an arithmetic average — no weighting, no recursion
  2. Equal Weighting: Every bar in the period has exactly the same influence
  3. Most Lag: Because old prices have equal weight, SMA reacts slowest to new price changes
  4. Window-Based: Each new bar drops the oldest bar — can cause sudden shifts when a large bar exits the window