The simple moving average keeps a fixed window of the last k values and averages them, sliding the window forward one step at a time. Unlike the EMA it forgets sharply: a sample counts fully until it falls off the back of the window, then not at all. Its memory is exactly k — bounded, and independent of how long the stream runs. Maintained cleverly it costs O(1) per step (add the new, subtract the one that left). It is the boxcar filter of signal processing and the moving line on every price chart: a running summary whose cost never grows with the data, only with the window you chose.
A stream and a window of 3. The demo reports the average of the last three — bounded memory, sliding forward: live demo
“A longer stream needs more memory to average recently.” — the SMA's memory is the window k, fixed forever; the stream can be endless and the cost per step never moves. cited
A window of fixed width, dragged along the stream; what leaves the back is subtracted, what enters the front is added. Memory that never grows. boxcar filter
On the canonical compiler, the window-3 average over the tail of [1,2,3,4,5] is (3+4+5)/3 = 4 — only the window is summarized: