Handling Short Histories in Rolling Maximum Calculations
Summary
The discussion addresses missing values from a rolling maximum over a fixed 1,000-day window when a stock has been listed for less than the full period. It proposes making the window length depend on the stock's available listing history: use the smaller of the target window and the listing-day count, then compute the maximum close over that window. This is intended to return the maximum observed close for newer listings instead of a missing result.
The reply cautions that listing age may overstate the amount of usable price history, for example when trading suspensions or data gaps occur. It suggests shortening the available-history estimate by a buffer before setting the window. That adjustment is a practical heuristic rather than a guarantee that sufficient observations exist; implementations should still account for missing data and confirm the rolling function's behavior on partial windows.
Key ideas
- A fixed rolling window can return a missing value when a security has fewer observations than the requested lookback.
- The suggested approach uses a variable window capped by the target length and based on listing age.
- Listing age may not equal the number of available price observations because of suspensions or gaps.
- A buffer below the estimated history length is suggested as a heuristic for avoiding incomplete data windows.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.