Simple moving average
The average close over the last N bars, drawn over the candles as a slow baseline.
The SMA averages the last N closes with equal weight, by adding each new bar to a running sum and dropping the oldest. Bars with no value are skipped, so the average always covers the last N real values. The line has no value until N bars have arrived, so it starts N minus one bars into the data.
How to read it
- The line sits on the price scale, drawn over the candles.
- Price above the line means it is trading above its recent average; below means under it.
- A steep slope means the average is moving quickly; a flat line means price has hovered near its average across the whole window.
What it outputs
- SMA
- Average of the last N closes, on the same scale as the candles.
Settings
- Window
- Sets how many bars the average covers, equal weight each. Raising it smooths the line, lags price more and turns less often; lowering it tracks the candles closely and bends at each small move.
Pitfalls
- The first N minus one bars have no value, so with the default 20 the line begins after 19 bars and the earliest candles show nothing.
- On a steady trend an SMA sits about (N minus 1) divided by 2 bars behind price, so a 20-bar line confirms moves late.
- On SPY one-minute bars for September 2026 with the default window, the median SMA sat within 0.001 percent of the median close and correlated 0.997 with it, so it mostly overlays price rather than separating from it.