Indicator Formula

Technical Details — Simple Moving Average (SMA)
Section titled “Technical Details — Simple Moving Average (SMA)”Overview
Section titled “Overview”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
Step 1 — Calculate Sum of Closes
Section titled “Step 1 — Calculate Sum of Closes”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
Step 2 — Divide by Period
Section titled “Step 2 — Divide by Period”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
- Simplest MA: Just an arithmetic average — no weighting, no recursion
- Equal Weighting: Every bar in the period has exactly the same influence
- Most Lag: Because old prices have equal weight, SMA reacts slowest to new price changes
- Window-Based: Each new bar drops the oldest bar — can cause sudden shifts when a large bar exits the window