The simple moving average (SMA) is probably the best-known technical indicator. It is used to smooth price action and highlight trends.**Calculation**

The SMA is the average price of an instrument over a specific time period:**n-day moving average = Sum(Pricet, Pricet-1 ...Pricet-N)/nwhere,Price t = today’s pricePrice t-n = price n days ago**

For example, a 20-day moving average is the average price of the most recent 20 days. The closing price is usually used in the calculation, although the high, low, opening or average price of a price bar can be substituted. To calculate, add the closing prices of the last 20 days and divide by 20.

As a market moves forward in time, the newest price is added to the average and the oldest is dropped from it. It shows a series of daily closing prices and the five day SMA values that result from progressively averaging the five most recent days’ prices.

Moving averages can be calculated for any time frame daily, intraday, weekly, monthly, etc. For a five minute bar chart, for example, a 10-bar moving average would be the average price of the 10 most recent five-minute bars. We will continue the discussion in terms of daily bars for simplicity.