Building Custom Timeframe Candles from Base Bars
Summary
This document describes how to combine lower-timeframe OHLCV bars into candles of a user-selected duration. It requires the target duration to be an integer multiple of the base-bar interval and checks that enough records are available. The aggregation aligns the initial bars to a target-period boundary, then takes the first open, maximum high, minimum low, final close, and accumulated-period volume to form each candle. It also handles a final partial group of available bars.
The example uses a two-hour target duration and plots the converted records, while explicitly saying that second-level periods are unsupported. The source is an implementation example rather than a trading strategy, and it provides no backtest or evidence about how the generated candles affect trading results. Time-boundary alignment and partial-candle treatment matter when using aggregated bars, and the described date and clock calculations impose constraints on which base and target intervals can be combined.
Key ideas
- The method aggregates base OHLCV bars into a longer user-defined candle interval.
- The target duration must be an integer multiple of the base interval, with sufficient source bars available.
- Aggregated candles use the first open, highest high, lowest low, final close, and volume from the period's last bar.
- The example aligns bars to period boundaries and includes a final partial aggregate.
- The document says second-level target periods are unsupported and gives no trading-performance evidence.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.