# Simple Moving Average

The Simple Moving Average (SMA) is a technical analysis indicator used to identify trends in asset prices by averaging out the price data over a specified period of time. The SMA is calculated by adding up the closing prices of an asset over a specific number of time periods and then dividing by the number of periods.

For example, a 10-day SMA would be calculated by adding up the closing prices of the last 10 days and then dividing by 10. This would give you the average closing price for the past 10 days.

The SMA is commonly used by traders to identify potential trend reversals and to confirm the strength of existing trends. A rising SMA indicates a bullish trend, while a falling SMA indicates a bearish trend.

Example:

Let's say you want to calculate the 20-day SMA for a stock. The first step is to add up the closing prices for the past 20 days. Let's assume that the closing prices for the past 20 days are as follows:

Day 1: \$10, Day 2: \$12, Day 3: \$11, Day 4: \$9, Day 5: \$8, Day 6: \$10, Day 7: \$11, Day 8: \$12, Day 9: \$13, Day 10: \$14, Day 11: \$12, Day 12: \$10, Day 13: \$9, Day 14: \$11, Day 15: \$12, Day 16: \$13, Day 17: \$15, Day 18: \$14, Day 19: \$12, Day 20: \$10.

To calculate the 20-day SMA, you would add up the closing prices for the past 20 days and divide by 20:

SMA = (10 + 12 + 11 + 9 + 8 + 10 + 11 + 12 + 13 + 14 + 12 + 10 + 9 + 11 + 12 + 13 + 15 + 14 + 12 + 10) / 20 = \$11.3.

So the 20-day SMA for the stock is \$11.3. This process would be repeated for each subsequent day in the data series.