All TermsIndicator

SMA (Simple Moving Average)

A simple moving average is the arithmetic mean of the last N closing prices. It treats every bar in the window equally, which makes it slower to react than an EMA but produces a smoother line.

When SMA wins

SMAs cut whipsaws. The 50/200 SMA "golden cross" / "death cross" on daily charts of major indices is the most-cited long-term trend signal in finance — and it actually works on indices precisely because the lag filters noise.

Formula

SMA(N) = (close[0] + close[1] + ... + close[N-1]) / N

SMA in Pine Script

pinescript
fast = ta.sma(close, 50)
slow = ta.sma(close, 200)

See SMA Crossover for the canonical golden-cross strategy.

Strategies that use SMA (Simple Moving Average)

Related Terms

Stop Reading. Start Trading.

PineForge backtests every concept on this site against real market data.

Try It Free