Moving Average Calculation

This thread about sales predictions and recursive loops might help you.