trend indicator
Simple Moving Average (SMA)
SMA calculates the average price over a fixed number of periods, giving equal weight to each period. It smooths price action to reveal the underlying trend.
Formula
SMA = (P1 + P2 + ... + Pn) / N where P = price, N = number of periods
Common strategies
- Golden cross: SMA(50) crossing above SMA(200) — a bullish long-term signal.
- Death cross: SMA(50) crossing below SMA(200) — a bearish long-term signal.
- Support/resistance: SMA(200) acts as dynamic support in bull markets and resistance in bear markets.
How CommonQuant uses it
CommonQuant pre-calculates SMA(20), SMA(50), and SMA(200) on all timeframes. DSL strategies can reference sma(period).
Frequently asked questions
What is a golden cross?
A golden cross occurs when the 50-day SMA crosses above the 200-day SMA. It's considered one of the most reliable bullish signals in technical analysis.
SMA vs EMA — what's the difference?
SMA gives equal weight to all periods, while EMA weights recent prices more heavily. EMA reacts faster; SMA is smoother. See /compare/sma-vs-ema for details.