Skip to content
All library documents

Building Higher-Timeframe Candles from Lower-Timeframe OHLCV Bars

Article Strategy library · Author: FawkesPan

Summary

This document describes a utility for constructing candles of a chosen minute interval from a sequence of lower-timeframe records. It groups source bars into time windows, then sets each aggregate candle's open from the first included bar, high and low from the extrema, close from the last included bar, and volume from the sum. A filter helper selects records within a time range, while companion functions fetch minute data or combine newly calculated bars with previously stored aggregates.

The example compares generated fifteen-minute bars with exchange-provided bars, but gives no quantitative validation or error analysis. Correct output depends on timestamp alignment, complete input data, and the chosen window boundaries; empty windows are skipped. The utility is a data-preparation technique rather than a trading signal, and users should check how their data source timestamps bars and represents missing intervals before relying on aggregates for research or execution.

Key ideas

  • Lower-timeframe records can be grouped into fixed-duration candle windows.
  • Each aggregate uses the first open, maximum high, minimum low, last close, and summed volume.
  • A time filter and optional start point support incremental candle reconstruction.
  • Empty windows are omitted, so gaps in source data can affect the resulting series.
  • The example offers a comparison with exchange data but no formal validation.

Tags

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