Our simple moving average equation will operate for an infinite input stream of ticks. We'll pick a starting point anywhere in the infinite input stream, pick a size n that we'd like to average, take the previous n (including the current) ticks, and apply our average equation.
Nominally, our equation will be similar to (/ price-sum (count ticks-within-window)).
price-sum, as the name implies, is the sum of all the prices with our chosen average range, and
ticks-within-window is the collection of ticks we want to include in our calculations.
The important part is that this equation has to be applied at each increment of the tick window. To get an average, therefore, we have to use the ...