0

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?

2
  • 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
    Commented Aug 25, 2021 at 12:03
  • Similar question on Stack Overflow: Does SMA include the current day?
    – Flux
    Commented Sep 9, 2021 at 9:37

2 Answers 2

2

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.

0

It could include the current price if you also had the previous days prices at approximately the same trade time. All the moving average cares about is that the intervals are equal, So, as an example, if you would wanted a more recent representation which included day 4's OPEN price, you could calculate the 3 day moving average as (open price day 4 + open day 3 + open day 2) /3

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .