Skip to content
All library documents

Loading Resampled Bars for Long Moving-Average Calculations

Article vn.py community

Summary

This forum exchange concerns the data requirements for calculating a 200-period moving average on 15- or 30-minute bars when a strategy begins with one-minute data. The original poster is concerned that loading many one-minute records and aggregating them at startup is inefficient, and asks whether five-minute aggregation or direct retrieval of 30-minute bars would help. Replies suggest using a time-series database for faster retrieval, or storing 30-minute bars directly if the application’s interval representation cannot distinguish them from one-minute bars.

The discussion is an implementation note rather than a trading-method evaluation. It highlights that the data stored and the platform’s interval conventions determine whether direct retrieval can work, and that aggregation may be avoided by persisting bars at the needed frequency. It does not benchmark alternatives, explain how to preserve bar boundaries or handle incomplete candles, or report strategy results. The database suggestion is anecdotal, and the exchange does not provide enough detail to establish which storage design is best for a particular system.

Key ideas

  • A long moving average on resampled bars requires enough history at the target frequency.
  • Repeatedly loading and aggregating lower-frequency bars can add startup work.
  • Storing target-frequency bars can enable direct retrieval when interval conventions permit it.
  • A time-series database is suggested as one way to speed up retrieval, without benchmark evidence.
  • The exchange does not assess bar-boundary handling or trading performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.