Suppose I have the historical closing prices of a stock, and the current real-time price. I want to calculate a simple moving average (SMA).

Historical prices:

Day Closing price
1 $1.10
2 $1.20
3 $1.30

Today is day 4. The markets are still open, and the last trade price of the stock is $1.35.

At this moment, while the markets are still open, which numbers do I use to calculate a simple moving average? Do I include the last trade price in the calculation? If I want to calculate the 3-day SMA, do I use the last trade price, day 3's price, and day 2's price to calculate the mean? Or should I use day 1's price instead of the last trade price?

  • Normally an unweighted, non-accumulative moving average is calculated by the mean of the previous k closing prices.. So I guess the current price shouldn`'t be included.
    – iLuvLogix
    Aug 25 at 12:03
  • Similar question on Stack Overflow: Does SMA include the current day?
    – Flux
    Sep 9 at 9:37

A 3 day moving average requires three days of closing prices (which you have) for the first calculation. If the market is still open on day 4 then it's not a daily close.

However, you could propose that if the market were to close at the current price of $1.35 then the 3 day SMA would involve days 2 and 3 as well as the current quote. You would then be able to see where the SMA3 is located relative to the current quote.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.