An OHLC bar summarises the prices observed in an interval using four values. The open is the first eligible price, the high the highest, the low the lowest and the close the last. Bars compress a stream of market events into a time series for charts, range measures and trading signals. The same symbol and interval can yield different bars if the underlying prices, eligibility rules or clocks differ.
From trades to a one-minute bar
Suppose four eligible trades occur at 09:31:00, 09:31:12, 09:31:28 and 09:31:51 New York time, at 100, 105, 99 and 102 USD per share, respectively. For the minute labelled 09:31, include trades timestamped at or after 09:31:00 and before 09:32:00. A trade at exactly 09:32:00 goes into the next bar. This start-inclusive, end-exclusive rule gives each boundary trade one home. Alpaca uses this convention for its stock minute bars. Alpaca Market Data FAQ
With one common set of eligible prices for all four fields, the open and close come from the ends of the sequence and the high and low from the extremes.
In the bar on the right, the vertical line spans the low to the high, the left tick marks the open, and the right tick marks the close. The hollow dot falls on the excluded right boundary.
Swap the middle two prices and the bar still reads 100, 105, 99, 102. In the original sequence, a trade reaches 105 first. In the swapped sequence, a trade reaches 99 first. A rule that acts on the first qualifying print at either level therefore needs information the bar discards. This is intrabar path ambiguity. The related article’s stop-and-target tool compares two stipulated paths under assumed fills at the touched levels.
What went into the four prices?
- Price source. A trade price comes from a completed transaction. A quote describes displayed buying or selling interest. A bid, ask or quote midpoint can each be summarised as OHLC. A midpoint high says how far the midpoint rose, and cannot establish that any trade took place there. OANDA’s API exposes separate bid, ask and midpoint candles. OANDA Instrument Definitions
- Trade eligibility and clock. Some prints update volume while leaving all four prices unchanged. Alpaca’s stock-bar rules give certain odd-lot prints this treatment. The timestamp used to group trades also matters. Databento assigns trades to OHLCV intervals using its trade receipt timestamps. Its daily bars follow UTC dates, so they can cover a different span from bars aligned to an exchange session. Alpaca Market Data FAQ, Databento OHLCV
- Empty intervals. Databento emits no OHLCV record when no trades occur in an interval. On a regular minute grid, you can represent this as a row with missing prices or, for a last-price series, carry the prior close forward and flag the row as synthetic. A carried close is stale and supplies no evidence of a new trade. If you omit the row, a window of a fixed number of rows can span a variable amount of clock time. Databento OHLCV
When could a strategy see the close?
The 09:31 label identifies the interval’s start. A strategy can use a completed version only after that minute ends and the version reaches the strategy. Alpaca streams its initial stock minute bars just after the minute mark and can send an update after the half-minute mark when a late trade belongs to the previous minute. A backtest that uses a revised close before the revision arrives introduces look-ahead bias. Preserve both the interval timestamp and the receipt time for each version when replaying what a live strategy could see. Alpaca Real-time Stock Data
The SelfMadeQuant lesson Event Time and Alternative Bars shows how grouping the same stream by trade count, volume or traded value changes which price closes a bar. The preview is public and the full lesson requires membership.
Sources
- Alpaca Market Data FAQ — stock-bar boundaries and trade-condition rules.
- Alpaca Real-time Stock Data — initial and updated minute bars.
- Databento Aggregate Bars (OHLCV) — bar interval timestamps, daily alignment and no-trade intervals.
- OANDA Instrument Definitions — bid, ask and midpoint candle definitions.