What is SMA?
A simple moving average draws one line through price by averaging the last n bars, with every bar in that window counting the same. Short-term noise is taken out, so the direction of the trend is easier to see than on the candles alone. Because no bar is favoured, it is the smoothest and slowest of the common averages at a given length.
SMA describes where price has been on average. It does not measure trend strength, it does not react to a sudden move faster than a fraction of that move, and it does not predict future prices.
How to use SMA
- Price above or below the line. Price holding above the SMA is read as context for an uptrend, below it for a downtrend.
- The slope. A rising line means the bars entering the window are higher than the ones leaving it. A flat line means they are roughly equal.
- A fast and a slow SMA crossing. When a shorter average crosses a longer one, the recent window has moved above or below the longer one. That crossing is late by construction, since both lines lag.
- Period length. Shorter follows price more closely and crosses it more often; longer is smoother and later.
These are ways to read the line, not entry signals on their own.
Settings
| Setting | Default | What it changes |
|---|---|---|
| Length | 9 | Bars in the average. Lower follows price more closely and whipsaws more; higher is smoother and later. Minimum 1. |
| Source | Close | Which price each bar contributes. Open, high, low and the averaged sources such as hl2 and hlc3 are also available. |
Adjust the period and price source in the indicator settings.
Calculation
The SMA adds up the chosen price over the last n bars and divides by n:
SMA = (price[0] + price[1] + ... + price[length - 1]) / length
With the default length of 9:
SMA = sum of the last 9 closes / 9
Each bar contributes exactly 1/9 of the result at the default length, so a new bar can move the line by no more than a ninth of its own move. When the next bar arrives, the oldest one drops out of the window entirely. That hard edge is why an SMA can change direction because of a bar leaving the window as much as because of a bar entering it.
The line starts once a full window of bars is available, so the first value appears on the ninth bar with the default length.
Limitations
- It lags. Every bar in the window counts equally, so old prices hold the line back for the full length of the window.
- The oldest bar matters too. The line can turn when a large bar drops out of the window, even if nothing new happened on the latest bar.
- Sideways markets produce repeated false crossovers. With no trend to follow, price crosses the line again and again.
- It depends on timeframe, period and source. The same indicator gives a different line on 15m than on 1D, or on close against hl2.
- It is not a strategy. On its own it carries no risk management, sizing or exit.
Frequently asked questions
A simple moving average is the arithmetic mean of the last n prices. Every bar in the window carries the same weight, and when a new bar arrives the oldest one drops out. In Altrady Charts it is listed as Moving Average.
An SMA weights every bar in its window equally and ignores everything outside it. An [EMA](/library/indicator/ema) weights recent bars more heavily and lets older ones fade out gradually. At the same length the EMA turns sooner and the SMA is smoother.
There is no single best period, only a trade-off between responsiveness and smoothness. The built-in default is 9. Shorter lengths react sooner and give more false signals in choppy markets; longer lengths are steadier and later. Choose the length for the timeframe you trade and test it.
Yes. The indicator has two inputs: Length, default 9 with a minimum of 1, and Source, default close. Open the indicator's settings on the chart to change them. Source accepts open, high, low, close and the averaged sources such as hl2 and hlc3.
No. Each value depends only on the bars inside its window, so values on closed bars are not revised. The current candle's value moves while that candle is live and settles when it closes, which is normal for any moving average.
Use the Add to chart button at the top of this page. It opens BTC/USDT on Binance in the Altrady Charts terminal with the built-in Moving Average already applied. On any other market, open the indicator picker on the chart and choose Moving Average from the Moving Average group.