Simple Moving Average Formula

Simple Moving Average Formula (SMA) Explained

If you like math, you’ll like the simple moving average formula. You take the total of the closing prices and add those together. Then, you divide by the number of days. So, if you picked the 50 or the 200 SMA, you’d add up all those closing prices and divide by 50 or 200. If you pick the 5 SMA, you’d add up five closing prices and divide that by 5. But the great thing is that you already have those moving average lines set for you, and you don’t have to get your simple moving average calculator out.

SMA’s are one of the foundations of technical analysis. They can be used to tell you a lot at a glance. For example, the simple moving average formula can be used as support and resistance or as a trend line.

Knowing the stock trend will help you know what to buy, especially when trading options. Knowing whether or not to buy calls (bullish) or puts (bearish) is the difference between profit and loss.

The Simple Moving Average (SMA) formula is a popular technical indicator used to calculate an average price over a specified period, which helps in identifying trends in stock market prices. The SMA gives equal weighting to all price data within a given period.

The formula to calculate SMA is as follows:

SMA = (Sum of closing prices over ‘n’ periods) / ‘n’


Sum of closing prices over ‘n’ periods: The total of all closing prices for a specified number of periods.

‘n’: The number of periods used to calculate the SMA.

For instance, to calculate the 10-day SMA, you would add the closing prices for the previous ten days and then divide the total by ten.

Simple Moving Average Signals

When a short-term SMA crosses above a long-term SMA, it signals the beginning of a long-term trend. You can also use the SMAs as support and resistance levels. You can customize your moving averages by choosing the different time frames you want to look at. Getting in on a moving average crossover is usually a bit more forgiving of a strategy, but that doesn’t mean you should fat-finger the trade.

The SMA is used to smooth out volatility. This makes it easier to see a price trend. If the SMA points up, you’ll know the trend is bullish. If the SMA points down, you’ll know the trend is bearish.

Using simple moving averages, you can identify trends when trading stocks. The longer period you use for your SMA, the smoother your trends will be. The shorter your time frame, the more volatility you’ll see.

Simple Moving Average Formula Example

Simple Moving Average Formula Example

This is an example of the simple moving average formula studies using the ThinkorSwim platform. You’ll notice I also have VWAP on the chart as well.

Simple Moving Average Formula Crossover

The simple moving average formula is a bullish breakout pattern that the SMAs form. You get this cross when a short-term SMA crosses above a long-term SMA.

Traders like this cross because the longer-term SMAs crossing holds more weight, and the breakout is more long-term.

The most popular SMAs for the Golden Cross are the 50 and 200 SMAs. When the 50 crosses the 200, the 200 SMA, a strong resistance level, becomes support, and the uptrend into a bullish market is strong.

Simple Moving Average Formula Chart

This is a chart for AAPL, and you can see in the shaded area that the purple line is the 50 SMA, and the blue line is the 200 SMA. The 50 crossed the 200. That is the golden cross. The stock moved into a bullish trend and has continued for now. The golden cross is a popular bullish indicator for traders.

The highlighted area showed a bear flag setup. The red arrow shows where traders would go short on the flag. There was a bullish engulfing pattern that held the moving average lines. Then, there was a small cup and handle breakout.

Death Cross

Another simple moving average formula is the death cross. The death cross is a bearish signal, and it gets its name from the X it makes when the cross occurs. The death cross is typically seen as a short-term move because it does not guarantee the price will fall long-term. Other things can cause the market to turn around even though there’s fear related to that trend. If you see the death cross occur, there will be further losses, typically short-term.
AAPL Simple Moving Average

Here is the chart for AAPL that shows you the death cross. The 200 SMA is blue, and the 50 SMA is purple. They cross, and you can see the X. The 200 SMA, which used to be supported, becomes resistant. The crosses are an easy, simple moving average trading strategy. Exponential moving average crosses are important to watch for short-term reversals.

The first two arrows on the chart showed a falling wedge pattern. The next three arrows made up a rising wedge pattern. Two of the last three made up a double-top pattern.

Which Moving Average Is Best?

Here are the best moving average line:

  • Nine exponential moving averages & 20 ema, good for intraday trading
  • Or 13 ema instead of 9 and 20
  • 50 simple moving average, good for longer-term trend trading
  • 200 sma. Some like the 100 sma as well. Both are good for identifying trends

Choosing Different Time Periods

Traders calculate the SMA using various periods to detect short—or long-term trends. SMAs with longer periods use more price data points, thus providing a wider view of the market trend. Conversely, SMAs with shorter periods are more responsive to short-term price fluctuations and can give more signals for trend reversals.

While the calculation of the SMA may seem straightforward, traders should understand its strengths and limitations before using it. The SMA is useful for comparing and validating trading strategies when paired with other technical indicators.

Trade Ideas Logo TrendSpider Premium Partner Benzinga
DESCRIPTION Trade Ideas provides powerful tools like real-time market scanning, AI-driven trade signals, customizable alerts, advanced charting capabilities, and time-saving data visualization TrendSpider is the most robust all-in-one trading platform on the market today. Uncover strategies, pinpoint opportunities, analyze assets, and time trades like never before Benzinga allows traders to profit with actionable stock news, trading signals and alerts, A streaming platform with all the information you need to invest smarter today

Simple Moving Average Formula Limitations

The Simple Moving Average (SMA) formula isn’t perfect and has a few limitations you must know. Let’s unpack them below: 

1. It's a Lagging Indicator

We consider a moving average a lagging indicator because it reacts to price changes after they occur. It lags. Hence, one must observe the moving average trend over a longer period to get a clear idea of the market trend. 

Likewise, the SMA is a lagging indicator based on historical prices. This means that the SMA reacts to price changes after they have already occurred, which can result in delayed entry and exit trade signals.

2. The Whipsaw Effect

During choppy or ranging markets, the SMA can produce false signals known as the “whipsaw effect.” The whipsaw effect is characterized by rapid and sharp changes in price direction, which can result in false trading signals and confusion for market participants.

The whipsaw effect is when the price of a security or market initially moves in one direction but quickly reverses and moves in the opposite direction. It can also occur in bullish (upward) and bearish (downward) markets. Not surprisingly, it can catch traders off guard, resulting in unexpected losses or missed trades. 

For example, in a bullish market, the price of a stock may start to rise, leading traders to believe that an upward trend is forming. As a result, they go long and try to ride the momentum upwards. However, the price suddenly reverses and tanks. Those traders in long positions are hit with a bad case of whiplash if they don’t have a stop loss. Once again, this underscores the importance of proper risk management. You can read more about preventing whiplash on our risk management blog.

3. Sensitivity to Price Volatility

The SMA may not be suitable for highly volatile markets as it can smooth out price fluctuations over the selected period. As a result, in volatile conditions, the SMA may not accurately reflect the current market sentiment and trend.

4. Equal Weight

The SMA gives equal weight to all data points within the selected period, which may not be ideal for all market conditions. In some cases, recent price movements may be more relevant for trend analysis than older data, but the SMA treats all data equally.

5. Fixed Periods

Remember that the SMA relies on a fixed number of periods for calculation, which isn’t always the best for dynamic market conditions. Traders may need to adjust the period length to adapt to changing market environments.

Final Thoughts: Simple Moving Average Formula (SMA)

Using the SMAs to find support and resistance is a great tool. SMA support and resistance are good for long-term or swing trading, such as following the crosses. These indicators tell you what direction the market is moving.

You do not want to make blind trades, so reading charts and using technical analysis are key.

We can’t rely on just one indicator when making trading decisions. Using the SMA with other technical indicators is essential to have an edge and win this game! 

Frequently Asked Questions

Example of the Formula for Moving Averages:

  • Example: 50 sma
  • Add up all of the closing prices during 50 days, then divide by 50
  • This is done automatically by adding an indicator

The formula for the 20-day simple moving average line is calculated by adding up the pricing over 20 days and then dividing that number by 20. This is done automatically within your brokerage platform.

How to set a simple moving average:

  • Log into your brokerage account
  • Go to filter studies
  • Edit filter studies
  • Find the moving average study
  • Edit the moving average lines per your preferences

Common simple moving average lines:

  • 50 day SMA
  • 100 day SMA
  • 200 day SMA

The five-day simple moving average line (SMA0 adds up the five recent prices on a stock and then dividing the number by five.

Related Articles

Harmonic Patterns

Harmonic Patterns

Have you heard of Harmonic patterns? Technical analysis can be a polarizing subject in the world of investing. Some traders swear by it, while others

Read More »


If you’ve looked for trading education elsewhere then you’ll notice that it can be very costly.

We are opposed to charging ridiculous amounts to access experience and quality information. 

That being said, our website is a great resource for traders or investors of all levels to learn about day trading stocks, futures, and options. Swing trading too! 

On our site, you will find thousands of dollars worth of free online trading courses, tutorials, and reviews.

We put all of the tools available to traders to the test and give you first-hand experience in stock trading you won’t find elsewhere.

Our content is packed with the essential knowledge that’s needed to help you to become a successful trader.

It’s important to treat day trading stocks, options, futures, and swing trading like you would with getting a professional degree, a new trade, or starting any new career.

Invest the proper time into your Trading Education and don’t try to run before you learn to crawl. Trading stocks is not a get-rich-quick scheme. It’s not gambling either, though there are people who treat it this way. Don’t be that person! 


The Bullish Bears team focuses on keeping things as simple as possible in our online trading courses and chat rooms. We provide our members with courses of all different trading levels and topics.

If you’re a beginner, intermediate level, or looking for expert trading knowledge…we’ve got you covered. 

We have a basic stock trading course, swing trading course, 2 day trading courses, 2 options courses, 2 candlesticks courses, and broker courses to help you get started. Free.

Just choose the course level that you’re most interested in and get started on the right path now. Become a leader, not a follower. When you’re ready you can join our chat rooms and access our Next Level training library. No rush. We’re here to help.

Click Here to take our free courses.