# How is the Simple Moving Average (SMA) calculated if some days have no trades?

I want to calculate the 10-day SMA of a stock. However, there are some trading days when no trades took place for the stock (i.e. volume is zero). For the days that have zero volume, what is the stock price that should be used to calculate the SMA? Is it the closing price of the previous day that had a trade? Or is it \$0?

A 10 "period' moving average involves the data for the last 10 periods of trading. It could be for any period of time (minute, hour, day, etc.).

A market day when there is no trading is the same as a weekend or a holiday. It is ignored, as is any shorter intraday time frame.

• I guess this answer is appropriate in most situations where there are only a few periods with no trades. One situation where this answer is less appropriate: in illiquid securities where no trades happen for months at a time (e.g. some OTC stocks).
– Flux
Oct 21, 2022 at 6:56
• Mathematically, moving averages are useless with illiquid stocks or anything with a wide bid/ask spread. Oct 21, 2022 at 22:27

It might depend on what you're using the SMA for, but I certainly wouldn't use zero.

I can see two viable options - the most intuitive to me is to use the prior closing price for the days on which there are no trades. That would cause the SMA to converge to the last price over 10 days.

Another option might be to use the prices for the past 10 days on which there were trades. That would cause the the SMA to be "flat" until the day after a trade).

• "the prices for the past 10 days on which there were trades" — Does this mean the average of the prices of the past 10 days that had trades?
– Flux
Oct 10, 2022 at 15:45
• @Flux correct - although that would be my second choice by a longshot, depending on what the SMA was used for. Oct 10, 2022 at 15:53
• I thought about using linear interpolation for the missing prices. Not sure if that is a sound method though. It seems that most technical analysis tools use "forward-filling" (i.e. for days with no trades, the prior closing price is used).
– Flux
Oct 10, 2022 at 15:57
• I'm not sure linear interpolation would be helpful, if anything it would bias the HMA based on recent results. You could possibly use the beta of the stock and the return of some large index to imply a price. e.g. if the stock does not trade but has a beta of 2, and the S&P has a 1% increase one day, assume that the stock would have a 2% increase. At least that way you keep the HMA of the stock in line with market changes. Oct 10, 2022 at 16:15
• What is "HMA"? How is it related to the SMA?
– Flux
Oct 10, 2022 at 22:16