Skip to content
All library documents

Updating Multi-Timeframe Indicators Before a Bar Closes in VeighNa

Article vn.py community

Summary

This forum exchange explains how to access an in-progress aggregated bar when calculating indicators before a higher-timeframe candle closes. A BarGenerator must first receive lower-timeframe bars through its update method; once initialized, its current window bar can be read. The discussion distinguishes that live aggregate from a completed bar and shows why the object may be None if no eligible input bars have reached the generator.

It also warns against repeatedly adding an unfinished bar to ArrayManager. That component appends bars by count and does not replace an existing entry with the same timestamp, so repeated updates can corrupt the indicator history. The reported error trace illustrates a None window bar when a five-minute callback tries to read a separate ten-minute generator before the latter has produced a bar. The exchange gives practical debugging guidance, but does not provide a complete tested implementation for maintaining provisional indicator values.

Key ideas

  • Feed lower-timeframe bars into BarGenerator before reading its aggregated window bar.
  • A generator’s current window bar can be unavailable until it receives enough input data.
  • ArrayManager appends bars rather than replacing an unfinished bar with the same timestamp.
  • Repeatedly adding provisional bars can make indicator state inaccurate.
  • The example error occurs when code reads a ten-minute window before it exists.

Tags

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