Trends/Moving averages

Simple moving average

The average of the last N closing prices, redrawn at every bar. It smooths out the day-to-day noise.

Moving averagesBest on 3M, 6M, 1YAlso called SMA
Simple moving average diagramIllustration of the simple moving average shape. It is a sketch, not real price data.20-bar average
Illustration of the simple moving average shape. It is a sketch, not real price data.

What it shows

A simple moving average (SMA) adds up the last N closes and divides by N. When a new bar arrives, the oldest close drops out and the newest is added, so the line moves along with price.

Because it looks backward, it always trails price. A longer N makes a smoother line that trails more. Common choices are 20, 50, 100 and 200.

How we find it

The same code that draws it on your chart follows these steps, with the same result every time.

  1. Choose N (number of bars).
  2. For each bar, add the last N closes.
  3. Divide by N.
  4. Plot the result.

Starting values: N 20, 50 and 200 shown. These are proposed and will be tuned on real price data before launch.

How to read it

  • The line shows the average price over the last N bars.
  • Price above the line means the latest close is above its recent average.
  • A steeper line means the average is changing faster.

Status labels you may see

LabelWhat it means
Above the averageThe last close is above the SMA.
Below the averageThe last close is below the SMA.
CrossingPrice crossed the SMA in the last 3 bars.

What cancels it

Nothing cancels it. It is a calculation, not a pattern.

What traders check next

  • How many bars price has spent on one side of the line.
  • The slope of the line.
  • How far price is from the line.

Limits

  • It lags, so it shows past direction.
  • In sideways markets price crosses it many times.
  • Every bar in the window counts equally, so an old spike drops out suddenly.

Try it in forecastviz

  • Open any ticker and choose Moving averages → Simple moving average in the left menu.
  • Switch between 3M, 6M, 1Y to see how the picture changes.
  • Compare with Exponential moving average and Weighted moving average on the same chart.

Questions

Which N should I use?

It depends on your time frame. 20, 50 and 200 are common.

Is it the same on every chart?

Yes. The same data gives the same line everywhere.

Related trends

Further reading

  • Murphy, Technical Analysis of the Financial Markets
  • Kaufman, Trading Systems and Methods
  • Achelis, Technical Analysis from A to Z

Educational only. Not financial advice, and not a price forecast. Charts are drawn by code from past price data, which may be delayed.