Simple Moving Average (SMA)

The arithmetic mean of the last N closes. The cleanest, slowest, most-quoted moving average. Reference standard for long-horizon trend identification.

Updated 2026-05-24
7 min read
beginner

The arithmetic average of the last N closing prices, weighted equally. The slowest of the standard moving averages, and the cleanest reference for long-horizon trend.

Placeholder · Video / Clip

SMA(50) and SMA(200) on MES daily

Author hint: MES daily, dark theme, ~120-bar window. SMA(50) and SMA(200) overlaid as two solid lines on the price chart. Show a stretch of trending market where the two are clearly separated, then a chop period where they converge. No annotations. ≤ 8 seconds, no audio. Save to /public/images/guide/indicators/sma/chart.mp4.

What it measures

  • Trend baseline. Where price has been on average over the lookback window — a stable reference that doesn't whip around.
  • Equal-weight history. Unlike EMA, every bar inside the window contributes the same amount. A spike 50 bars ago counts the same as the most recent close.
  • Long-horizon regime. SMA(200) on a daily chart is the textbook "is the market in a bull or bear regime" question.

Formula

How AlgoLift computes it

SMA[i] = (price[i] + price[i−1] + … + price[i−period+1]) / period

Every bar inside the window contributes 1/period of the result. There's no weighting, no decay, no smoothing constant. When a bar drops out of the window on the next tick, its influence vanishes completely — which is why SMA can "jump" slightly when a particularly high or low bar exits the lookback.

Inputs in AlgoLift

SettingDefaultRangeNotes
Period201–500Lookback in bars. The most common values across strategies are 20, 50, 100, and 200.

Recommended periods

  • 20: Short-term trend on intraday charts. Roughly one trading day's worth of 30-minute bars.
  • 50: Medium-term trend. The de-facto "intermediate trend" line on daily charts.
  • 200: Long-term regime. The classic "bull market = above 200-SMA, bear market = below" filter for equities and equity index futures.

Outputs in AlgoLift

HandleTypePlottedNotes
SMA ValueNumericAlwaysThe SMA line. Comparable directly to price.
SlopeNumericOn selectBar-over-bar change in SMA. Cleaner than the EMA slope because the underlying line is itself smoother.
Placeholder · Screenshot

SMA node — default state

Author hint: The SMA node on a fresh canvas with default Period=20. Show the period input, both output handles labeled. Dark theme. Tight crop. Save to /public/images/guide/indicators/sma/node.png.

How to read it

  • Price above SMA: Average of recent closes is below current price. Up-state.
  • Price below SMA: Down-state.
  • Rising SMA slope: Average is climbing — trend continues.
  • Falling SMA slope: Average is dropping — trend is fading or reversing.
  • Price crossing SMA: Less informative on its own than an EMA crossover because the SMA is too slow to react in real time. Best used with confirmation.

The most useful comparison is SMA vs. EMA at the same period. The EMA leads; the SMA lags. When they diverge significantly, the market is moving fast in one direction. When they're stacked tightly, the market is going sideways.

Key Takeaway

Use SMA when you want a stable reference, not a fast one. Long-period SMAs are the cleanest regime filter in trading. Short-period SMAs are usually outperformed by EMA at the same length.

Best in / worst in

Best in regime classification (price above/below SMA(200)), high-noise instruments where you need the smoothing, and as a baseline for Bollinger Bands — which are built on SMA + standard deviation by default.

Worst in fast intraday execution. SMA's equal weighting means it lags real changes by roughly half the period. A 50-SMA on 5m bars is reacting to what happened 2 hours ago.

Three setups

1. Trend regime filter

Use SMA(200) as the highest-level switch. Strategies only fire in the direction of the long-term trend.

  • Long-only mode: Price > SMA(200) — strategy is permitted to take long entries.
  • Short-only mode: Price < SMA(200) — strategy is permitted to take short entries.
  • Flat: Price within 0.5% of SMA(200) — no entries either direction.

This single filter dramatically reduces drawdowns on trend-following strategies in mainstream instruments.

Placeholder · Screenshot

SMA(200) as a long-only / short-only regime gate

Author hint: Node graph showing SMA(200) feeding two parallel comparisons (price > SMA and price < SMA) which gate two Entry nodes. Save to /public/images/guide/indicators/sma/setup-01.png.

2. Golden cross / death cross

Long-term trend change signal using SMA(50) crossing SMA(200) on a daily chart.

  • Golden cross: SMA(50) crosses above SMA(200) — bullish regime begins.
  • Death cross: SMA(50) crosses below SMA(200) — bearish regime begins.

These fire ~once or twice per year on major indices. Not a trading signal, a regime-shift detector.

3. Mean-reversion target

Price stretched far from a slow SMA tends to revert. A common pattern:

  • Enter long when price closes more than 2 standard deviations below SMA(50) — also known as crossing the lower Bollinger Band.
  • Target the SMA(50) value itself as the exit. Stop below the recent swing low.

The setup works best on range-bound instruments and fails badly during trend extensions.

Advanced patterns in AlgoLift

SMA(200) as a hard kill-switch for trend-following strategies. Connect an SMA(200) comparison directly into your strategy's entry condition AND gate. A bear-regime hard-stop on a momentum strategy can prevent most of the catastrophic drawdowns these strategies suffer during extended downturns. See risk management.

SMA on a higher timeframe with EMA execution. Use SMA(50) on a 1h or daily timeframe as the regime filter, and use a faster EMA on a 5m execution chart for entries. The slow stability of SMA pairs naturally with the responsiveness of EMA. Wire both as separate data series in the Visual Builder.

Placeholder · Screenshot

SMA(50) on daily gating EMA(20) crossover on 5m

Author hint: Node graph showing SMA(50) on a daily data series feeding an AND gate alongside an EMA(20) crossover on a 5m execution series. Both series clearly labeled. Save to /public/images/guide/indicators/sma/setup-02.png.

Common mistakes

  • Using a short SMA for fast decisions. A 5-period SMA on 1m bars is responding to the average of the last 5 minutes — it's never going to feel "fast." Pick the right tool: EMA, DEMA, or HMA all react quicker at the same period.
  • Treating golden/death crosses as entry triggers. They're regime markers, not signals. The actual entries should come from a faster system that respects the regime.
  • Ignoring the equal-weight property. A single huge bar 49 days ago still pulls SMA(50) until it falls out of the window. Some chop near the SMA is sometimes just an old extreme dropping off.
Common Misconception
Myth
SMA is outdated — EMA is strictly better.
Reality
They measure different things. EMA prioritizes recency; SMA prioritizes stability. For regime classification on daily bars, SMA(200) is the right choice because you want a stable reference that doesn't whipsaw on a single bad week. For intraday signals, EMA wins because lag is the enemy.