Skip to content

Glossary

Moving Average (SMA): Meaning, Formula and Use

A moving average is the average closing price over the last N candles, recalculated on every new candle so it 'moves' with price. The simple moving average (SMA) weights every candle equally; traders use it to smooth noise and judge trend direction. On TradingLead, add it from the chart's Indicators dialog by searching 'Moving Average'.

Definition

A moving average (MA) is the average of a price — usually the closing price — over a fixed number of recent candles. Each time a new candle closes, the oldest candle drops out and the newest enters, so the average "moves" along the chart. The most basic form is the simple moving average (SMA).

Formula

For a period of N candles:

SMA = (Close₁ + Close₂ + … + Close_N) ÷ N

Example: a 5-day SMA with closes of 100, 102, 101, 104 and 103 is (100 + 102 + 101 + 104 + 103) ÷ 5 = 102. The next day, the oldest close (100) is dropped and the new close is added.

The first N − 1 candles have no value, because there is not yet enough history.

How traders read it

  • Trend direction: a rising SMA suggests an uptrend; a falling SMA suggests a downtrend; a flat SMA suggests a range.
  • Price vs average: price holding above a long SMA (for example the 200-day) is often read as a healthy long-term trend.
  • Crossovers: a shorter SMA crossing above a longer one (for example 50 over 200, the "golden cross") is read as strengthening momentum; the reverse is a "death cross".
  • Dynamic support/resistance: in trends, pullbacks sometimes pause near a widely watched average.

Common settings

UseTypical period
Short-term / swing10, 20
Medium-term50
Long-term (daily charts)100, 200

The source is usually the close, but you can also average the high, low or typical price.

Pitfalls

  • Lag: an SMA is always behind price. Longer periods lag more.
  • Whipsaws: in sideways markets, price crosses the average repeatedly, producing false signals.
  • Timeframe mismatch: a 50-period SMA on a 5-minute chart is not the same as a 50-day SMA.
  • Data gaps: missing candles or a different data feed change the result.

How to add a moving average on TradingLead

  1. Open a chart at tradinglead.in/charts.
  2. Click Indicators in the top toolbar and search Moving Average. Related options include Moving Average Exponential, Moving Average Weighted and MA Cross.
  3. Click it, then open its settings to set the length and source.

You can also code it yourself in Indicator Studio. A Pine v6 example (TradingLead supports a documented Pine v5/v6 subset):

//@version=6
indicator("SMA", overlay=true)
plot(ta.sma(close, input.int(50, "Length")), "SMA")

For a Python version, see Write a Python indicator. Compare with the faster-reacting EMA.

Educational content only — not investment advice.

Frequently asked questions

What is the difference between SMA and EMA?
An SMA gives every candle in the window equal weight. An EMA gives more weight to recent candles, so it reacts faster to new price moves.
Which moving average periods are popular in India?
Common choices are 20 for short-term trend, 50 for medium-term and 200 for long-term trend on daily charts. The '200 DMA' (200-day moving average) is widely quoted for Nifty and large-cap stocks. These are conventions, not rules.
Is a price crossing above the moving average a buy signal?
Not by itself. Crossovers are lagging and produce many false signals in sideways markets. Treat them as one input, test them, and remember this is not investment advice.

Last updated: