To give a little context, this is for a programming assignment at school so the simplest form of proper moving average is all that's needed. I've searched around and seen the summation formulas and all that good stuff but I'm still a bit unclear on the algorithm.
Suppose I am current displaying 30 days worth of information for a stock (FDX), from 4/25/11 - 6/6/11. Naturally the x-axis represents some time interval and y-axis is my closing price. Now, I need to display a simple moving average. There is where I get a bit confused. To get the moving average for 4/25/11 do I just go back 30 days from that, sum those 30 days, divide by 30 and that will be my "close price" or "y point"? If so that means the moving average for 6/6 will include all data points up to 4/25 and also 4/21 (4/25 must have been a Monday)?