I understand that the SMA is just the mean of the last closing prices in a given period. What i don't understand is how this can be drawn in real time, given that EOD closing prices only change once everyday. Is it a "rolling" period, such that the moving average is calculated by the closing prices at a specific candle? So the 9:45 1min candles close for the past 10 days? Also does the most recent candle have any affect on SMA calculation? Thank You.
1 Answer
Software programs will calculate moving averages and other technical indicators any way that the programmer instructs them to. :-)
In terms of practicality, an intraday calculation of an X period simple moving average is going to include the previous X-1 periods and today's current value. IOW, during the day, a 10 day SMA will include the past 9 days and the current value.
I can't help you with candles since I have never used them. Regarding your last question, if you are looking at a 10 period SMA of one minute bars, the periodicity is minutes not days. A 10 period SMA of one minute bars at 9:45 AM would contain 10 data points from 09:36 AM to 09:45 AM, assuming that the 09:45 AM one minute bar is completed.
-
Thank you for clearing that up for me! I've been trying to calculate my own indicators and have been stuck getting an accurate moving average.– 2ookJun 19, 2020 at 15:10