Skip to content
All library documents

Updating Minute-Bar Highs and Lows from Tick Data

Article vn.py community

Summary

The document asks how a bar generator should update the high and low of the current minute when a new tick arrives. The shown logic always compares the bar extremes with the tick’s last-traded price, then incorporates the tick’s reported high or low only when that value has moved beyond the preceding tick’s corresponding value.

The question contrasts this conditional approach with directly taking the maximum of the existing bar high and tick high, and the minimum of the existing bar low and tick low. The distinction is that tick high and low fields may describe cumulative extremes for a broader interval, rather than just the latest tick or current minute. Unconditional use can therefore carry forward an earlier extreme into the current bar. The excerpt poses the issue but supplies no answer, so the correct behavior depends on the data feed’s field semantics and how the generator tracks interval boundaries.

Key ideas

  • The bar update logic always includes the latest traded price in the current minute’s extremes.
  • Tick high and low fields are incorporated only when they change relative to the previous tick.
  • Directly applying reported tick extremes can introduce values from outside the current bar if those fields are cumulative.
  • The document asks the question but does not provide an authoritative answer.

Tags

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