Simple Moving Average (SMA)

The SMA is the plain average of recent closing prices: the simplest and oldest tool for seeing a trend's direction.

What it is

A simple moving average adds up the closes of the last N candles and divides by N; with each new candle the oldest one drops out. The result is a line smoother than price that filters out short-term noise.

How it's calculated

  1. SMA = (sum of the last N closes) ÷ N

How traders read it

  • The SMA's slope shows the trend's direction.
  • The 50- and 200-day SMAs are among the best-known levels in stocks and crypto.
  • The 50 crossing above the 200 is called a "golden cross", crossing below a "death cross".

Settings

Common lengths are 20, 50, 100 and 200. An SMA is slower than an EMA of the same length but less easily fooled by short swings.

Where it misleads

  • The SMA weights a very old candle the same as today's; when that candle drops out, the average can jump for no current reason.
  • Golden and death crosses tend to be late and error-prone in backtests; don't rely on them alone.

Its Pine Script on Vlevel

This is the script the chart runs. In the chart's indicators window you can open it, change it and save your own copy.

Moving Average Simple · Pine Script v6
//@version=6
indicator("Moving Average Simple", shorttitle = "SMA", overlay = true)
len    = input.int(9, "Length", minval = 1)
src    = input.source(close, "Source")
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(ta.sma(src, len), "SMA", color = #f5c542, offset = offset)

Indicators describe past prices; none predicts the future. For education, not investment advice.