Aggregating Fixed-Interval Bars into Larger Custom Candles
Summary
This document presents a reusable method for constructing larger candles from a stream of smaller, fixed-interval bars. It groups an integer number of base bars and derives each aggregate candle’s opening price from the first bar, closing price from the last, high and low from the group’s extremes, and volume from the sum. It also describes a manager interface for assembling records and viewing recent results in a table.
The method depends on compatible fixed intervals: the target must be an integer multiple of the base interval, with additional unit and clock alignment restrictions. It requires at least two input bars and filters combinations with invalid start times or gaps. The notes and code revisions mention corrections to volume aggregation, daily-bar handling, and timestamp alignment, which point to implementation edge cases. This is data preparation infrastructure, not a trading strategy; correctness still depends on reliable timestamps, complete input bars, and suitable handling of partial candles.
Key ideas
- The method aggregates an integer number of fixed-interval candles into a larger candle.
- The aggregate open and close come from the first and last component bars, while high and low are the group extremes.
- Aggregate volume is calculated by summing the component bar volumes.
- The target interval must be compatible with the base interval and satisfy the stated alignment constraints.
- Missing bars and partial groups can affect aggregation, so timestamp and input validation matter.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.