Handling Session Breaks in Custom Multi-Minute Bars
Summary
This forum post describes a custom bar generator intended to aggregate minute bars into arbitrary-length bars during daytime trading, then force out the remaining bar at the session close and restart the next day. The author reports an off-by-one-minute result when a seven-minute bar spans the midday market break: the generated bar ends one minute earlier than expected.
The included implementation initializes a window bar from each incoming minute bar, accumulates prices and volume, and increments an interval counter when the minute changes. It also uses a configured end-of-session time to flush the remaining bar. The post asks how to modify this logic, but gives no answer or verified correction. It does not clarify the data feed’s timestamp conventions or how the midday pause should count toward bar length, both of which matter when diagnosing the boundary behavior.
Key ideas
- The post concerns aggregating minute data into arbitrary-length intraday bars.
- The custom generator accumulates bar values and counts minute changes toward a target window.
- A midday session break is associated with an observed one-minute discrepancy.
- The code flushes a remaining bar at a configured end-of-session time.
- No confirmed fix or timestamp convention is provided.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.