Implement a function to calculate the moving average of a time-series stream without using high-level libraries.