if i want to calculate a simple moving average value for a point that has the same x value as data point n how do i calculate it? (lets say its a 3 period moving average) 1) MA value at point n = ((n-2) + (n -1) + n) /3 or 2) MA value at point n = ((n-3) + (n -2) + (n-1)) /3
n should coincide with the last complete closing price you have available. I.e. 1) 3 per SMA n1 -day 1 close - N/A n2 -day 2 close - N/A n3 -day 3 close:sma=sum(n1+n2+n3)/3 n4 -day 4 close:sma=sum(n2+n3+n4)/3 ... If x(n) or n(n) is not complete, it is not included or the corresponding sma data point is left open until the close has been established. For example, if n5 is still intraday, it has no corresponding sma for that daily pt. until the close of that day.