MarketInOut Stock Screener Log In | Sign Up

Moving Averages (SMA and EMA)

By MarketInOut · Updated October 29, 2026

A moving average smooths price by averaging it over a fixed number of bars, then moving that window forward one bar at a time. It is the oldest and simplest trend tool, and the building block of many other indicators, from MACD to Bollinger Bands. Traders use moving averages to see the direction of the trend, to find dynamic support and resistance, and to generate crossover signals.

Types of moving averages

  • Simple moving average (SMA). The plain average of the last N closes. Every bar has the same weight, so the SMA changes both when a new bar arrives and when an old one drops out.
  • Exponential moving average (EMA). Gives more weight to recent prices. It reacts faster to new moves and never drops old data abruptly.
  • Weighted moving average (WMA). Weights prices linearly: the latest bar counts N times, the oldest once.
SMA(N)  = (C1 + C2 + ... + CN) / N
EMA(t)  = C(t) × k + EMA(t-1) × (1 - k),   where k = 2 / (N + 1)

Shorter averages follow price closely; longer ones show the bigger trend. Common periods are 20 bars (about a month), 50 bars (about a quarter) and 200 bars (about a year).

How traders use moving averages

  • Trend direction. Price above a rising 200-day average is the most widely used definition of a long-term uptrend. The slope of the average matters as much as price’s position against it.
  • Dynamic support and resistance. In a steady trend, pullbacks often stop near the 20- or 50-day average. A decisive close through it is an early sign the trend is changing.
  • Price crossovers. Price closing above (or below) a moving average is the simplest trend signal. Longer averages give fewer, later, more reliable signals.
  • Two-average crossovers. A faster average crossing a slower one. The best known is the golden cross, the 50-day crossing above the 200-day, and its opposite, the death cross.
  • Filters. Many strategies only take long trades when price is above the 200-day average, and short trades below it.

The trade-off: lag versus whipsaws

Every moving average lags price, because it is built from past data. A short average lags less but crosses back and forth in sideways markets, producing whipsaws. A long average filters noise but signals late, after much of the move has happened. No setting removes this trade-off; choose the period that matches the length of trend you want to trade.

Signals that sound convincing don’t always pay. Our 25-year golden cross backtest found it beat the index fund on Canadian stocks but not in the US, which is a good reason to test a moving average rule before trading it.

SPY (SandP 500 ETF), daily, with the 50-day and 200-day simple moving averages.

Live chart: SPY (S&P 500 ETF), daily, with the 50-day and 200-day simple moving averages. The chart updates every trading day.

Screen for it on MarketInOut

Use sma(period) and ema(period) in formulas. The golden cross, today:

exch(nyse,nasdaq) and type(stock) and price > 1 and advol(21) > 1
and sma(50) ca sma(200)

Stocks crossing above their 200-day average:

exch(nyse,nasdaq) and type(stock) and price > 1 and advol(21) > 1
and price ca sma(200)

Related: MACD, Bollinger Bands, ADX and directional movement.




Disclaimer - Privacy Policy - Terms of Service - Cookies - FAQ - Affiliates - Blog