I have a time series of stock prices and wish to compute the moving average over a ten minute window (see diagram below). As price ticks occur sporadically (i.e. they are not periodic) it seems fairest to calculate a time-weighted moving average.
In the diagram there are four price changes: A, B, C and D, with the latter three occurring inside the window. Note that because B only occurs some time into the window (say 3 minutes), the value of A still contributes to the computation.
In fact, as far as I can tell the computation should be solely based on the values of A, B and C (not D) and the durations between them and the next point (or in the case of A: the duration between the start of the time window and B). Initially D will not have any effect as its time weighting will be zero. Is this correct?
Assuming this is correct, my concern is that the moving average will "lag" more than the non-weighted computation (which would account for the value of D immediately), However, the non-weighted computation has its own disadvantages:
- "A" would have as much effect on the result as the other prices despite being outside the time window.
- A sudden flurry of fast price ticks would heavily bias the moving average (although perhaps this is desirable?)
Can anyone offer any advice over which approach seems best, or whether there's an alternative (or hybrid) approach worth considering?