Choosing Rolling Windows for Market Data and Avoiding Look-Ahead Bias
Summary
The document discusses how to choose a rolling window type and length for trading inputs such as average spread or weighted price. It offers no universal selection rule: the choice depends on the data and the expected dynamics. A rolling window may be preferable to an expanding one when structural breaks could make older observations unrepresentative, while the expected duration of a change can motivate a window length.
The answer recommends reviewing the window choices made in relevant strategy research and testing sensitivity to alternative lengths. It cautions that choosing a window after examining the full dataset risks fitting decisions to observed outcomes. To limit that bias, explore choices on an in-sample subset. The response gives general practitioner guidance rather than a formal statistical procedure, and it does not provide specific adjustments for illiquid assets or cite a concrete paper beyond pointing to a related discussion.
Key ideas
- Window type and length should reflect the data and the expected market dynamics.
- Rolling windows can limit the influence of old observations when structural breaks are expected.
- An expected duration for a structural change can help motivate the window length.
- Sensitivity checks should be conducted on an in-sample subset to reduce selection bias.
Tags
Full text
# How to choose a rolling window type and size? # How to choose a rolling window type and size? I'm developing a trading strategy which takes into account certain parameters (e.g. avg spread, weighted price, etc). Of course, these parameters can be calculated over different window types (i.e. last X minutes/ticks/trades) and sizes. Obviously, there's no optimal window to be used in every instance, but I would appreciate a few pointers/references to papers discussing how to choose the right window type + size in different situations. Also, are there any special measures to be taken when applying such windows to market data of illiquid assets? ## Answer by JohnAndrews (score 5) https://quant.stackexchange.com/a/8646 This may be a tricky question and I am curious to see whether there is indeed a statistical methodology that tries to answer this question. To my experience it really varies with the data you are working with. For instance, one may choose a rolling window above an expanding window when there are structural breaks in the data, hence which can affect the structural estimates of the parameters. The length of this rolling window is then usually determined by means of some economic explanation. Moreover, when you expect that a structural or dynamic change is in effect for a particular period of time X, then you choose a rolling window of X days/minutes/ticks. As in your case, I would suggest to take a look at papers that discuss your trading strategies and why the authors choose this particular rolling window. It may be also useful to try a sensitivity analysis where you roughly `play' with various window sizes and see what happens. Important! The latter is not genuine modelling as you are observing the data first. To avoid for this bias, try to play with a sub-sample (in-sample) of your data.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.