The simple moving average (SMA) is the most basic type of moving average. It is calculated by taking the sum of a set of data points and dividing by the number of data points in the set. The formula for an SMA is:
SMA = (Sum of data over a specified number of periods) / (Number of periods)
For example, if you wanted to calculate a 10-day moving average of a stock's price, you would add up the closing prices of the stock over the past 10 days and divide by 10.