I know this is achievable with boost as per:
Using boost::accumulators, how can I reset a rolling window size, does it keep extra history?
But I really would
You simply need a circular array (circular buffer) of 1000 elements, where you add the element to the previous element and store it.
It becomes an increasing sum, where you can always get the sum between any two pairs of elements, and divide by the number of elements between them, to yield the average.