The trick is to put all the data into the array and then don't move it. The naive method is to move all the values down so that there's space at the top to put the new value in. Your program will spend too much time just moving data.
The clever way just keeps an index pointing to the oldest item. When a new item comes in, overwrite the oldest item and move the index to the next-oldest. Wrap around to zero when you run off the end of the array.
The averager is independent of the data-storer. You can average all values in the array at any time, without even knowing which one is the oldest.