Skip to Content

Simple Moving Average (SMA)

Learn about simple moving average with Composer and use our step-by-step guide to calculate this important portfolio metric.

In this article, you’ll learn about simple moving average of price and how it’s calculated in Composer.

What is Simple Moving Average?

Simple moving average calculates the arithmetic mean price of an asset over a given time period. It can be viewed as a “less-noisy” price of an asset.

Simple Moving Average Formula

The formula for simple moving average is calculated as follows:

Simple Moving Average Calculation

Simple moving average example

For a small-scale example, let’s say we want to calculate the 5-day simple moving average of an asset that’s currently trading at $10.00 on a Friday. The closing price was $6.00 on Monday, and it went up a dollar each day, so the closing price for each day looks like this:

  • Monday: $6.00

  • Tuesday: $7.00

  • Wednesday: $8.00

  • Thursday: $9.00

  • Friday: $10.00

While the current price is $10, the 5-day simple moving average would be $8.00. This helps smooth out the volatility of an average and is commonly used to indicate uptrends or downtrends.

Where do you see simple moving average in Composer?

Simple moving average is used in our Editor tool, most commonly in “If/Else” statements. An example is shown below:

Simple Moving Average can be used to create rules within a portfolio for systematic investing

In this example, we’re comparing the 10-day simple moving average of SPY to the current price of SPY. In calculation, Composer gathers the closing price of SPY for the last 10 days, sums them, and divides by 10, and compares it to SPY’s current price.

If the 10-day simple moving average of SPY is higher than or equal to the current price, the blocks of the symphony listed below the “If” statement will execute. Otherwise, the blocks listed below the “Else” statement will execute.

Step-by-step calculation for simple moving average

To calculate the simple moving average of an asset:

  • Select the asset and time period

  • For each day in the time period, log the closing price of the asset. Sum these together and divide the sum by the number of days in the time period

  • The output of this will be the simple moving average of the asset

Important Disclosures

Investing in securities involves risks, including the risk of loss, including principal. Composer Securities LLC is a broker-dealer registered with the SEC and member of FINRA / SIPC. The SEC has not approved this message.

Certain information contained in here has been obtained from third-party sources. While taken from sources believed to be reliable, Composer has not independently verified such information and makes no representations about the accuracy of the information or its appropriateness for a given situation. In addition, this content may include third-party advertisements; Composer has not reviewed such advertisements and does not endorse any advertising content contained therein.

This content is provided for informational purposes only, as it was prepared without regard to any specific objectives, or financial circumstances, and should not be relied upon as legal, business, investment, or tax advice. You should consult your own advisers as to those matters. References to any securities or digital assets are for illustrative purposes only and do not constitute an investment recommendation or offer to provide investment advisory services. Furthermore, this content is not intended as a recommendation to purchase or sell any security and performance of certain hypothetical scenarios described herein is not necessarily indicative of actual results. Any investments referred to, or described are not representative of all investments in strategies managed by Composer, and there can be no assurance that the investments will be profitable or that other investments made in the future will have similar characteristics or results.

Charts and graphs provided within are for informational purposes solely and should not be relied upon when making any investment decision. Past performance is not indicative of future results. The content speaks only as of the date indicated. Any projections, estimates, forecasts, targets, prospects, and/or opinions expressed in these materials are subject to change without notice and may differ or be contrary to opinions expressed by others. Please see Composer's Legal Page for additional important information.