Skip to content
All library documents

Candlestick Timestamps: Open-Time Versus Close-Time Bars

Article Quant Q&A · Author: Peque

Summary

The document compares assigning a candlestick’s timestamp to the beginning or end of its interval. It explains that close-time stamps can make bars from different timeframes easier to align, and can match the way weekly, yearly, or overnight session records are dated. It also notes that data vendors may use different conventions, so consistency across a system and its data sources matters.

A key practical risk is lookahead bias: an open-time label can make a bar’s eventual close appear available at the start of the interval. The discussion distinguishes an unfinished bar, whose high, low, and last price may still change, from a completed bar with fixed OHLC values. It recommends tracking the timestamps of individual bar fields when possible. These are implementation considerations rather than a universal rule; the answers describe tradeoffs and convention, not evidence that one timestamp scheme is always superior.

Key ideas

  • Close-time timestamps can simplify alignment across bars with different intervals.
  • Open-time timestamps can create lookahead bias if a completed close is treated as known at the bar’s start.
  • A bar’s values may remain provisional while its interval is still in progress.
  • Consistent timestamp conventions across data sources and trading systems are essential.
  • Recording the times associated with individual OHLC values can clarify when information became available.

Tags

Full text
# Candlesticks: timestamp on open versus close


# Candlesticks: timestamp on open versus close












It seems there is not a universal rule on how should the timestamps of candlestick data be set. I have the impression that using a timestamp on open is more common (i.e.: a 1-Minute candle with a timestamp at 00:00:00 would be open until a new tick is received at, at least, 00:01:00).

However, there seems to be software that generates candlestick data with the timestamp on close. See for instance the NinjaTrader docs:

> NinjaTrader stamps a bar with the closing time of the bar. For example, a minute bar with a time of 9:31:00 AM has data from 9:30:00 AM through 9:30:59 AM. Using end of bar time stamps is required in order to be able to plot multiple series of differing time frames within a single chart all accurately synchronized to time.

What are the advantages/disadvantages of each method? Why Ninja considered on-close to be better while it seems that most others are using on-open? What would you recommend?

### References

Timestamp on open:

- InteractiveBrokers

- Metatrader

- Oanda (not documented or I did not find it, but I know from experience)

Timestamp on close:

- Ninjatrader

## Answer by nbbo2 (score 4)

https://quant.stackexchange.com/a/25001

For what it is worth Bloomberg (e.g. GIT command) associates the time bar with the closing time of the bar. That does not make it right, but when there are multiple choices available I think being consistent with one reputable source is probably a good idea.

In fact in the documentation Bbg does not call the fields Open High Low Close, but Open High Low Last, which makes it clear that the fourth value is associated with the time stamp (it is the last price seen as of the time indicated).

## Answer by QuantPilot (score 4)

https://quant.stackexchange.com/a/83580

Closing time based timestamp makes it easier multi-timeframe alignment. You can line up 1-min, 5-min, 15-min bars exactly on the same axis with correct terminal times.

## Answer by Richard at NorgateData (score 3)

https://quant.stackexchange.com/a/24997

There is no particular advantage to either method once everything is aligned to the same methodology, and your systems understand that any particular bar is still "in session" (i.e. HLC represents a snapshot of the High, Low and Last and those are still able to change as new data arrives) or "completed" (i.e. OHLC is static).

Timestamp on close is more consistent across other timeframes other than 1 minute and is the de-facto standard for data vendors since it's more intuitive.

eg. Weekly data - the date of the record is the final trading day of the week. Yearly data - the date of the record is the final trading day of the year.

There are other markets that span multiple periods such as futures/forex sessions that start in an evening and finish some time the next day. The "session" timestamp is the date when the session closed. eg. Spot forex starts trading on Sunday New York time and the session closes and settles on Monday at 5pm. The date for that bar is Monday's date.

## Answer by experquisite (score 3)

https://quant.stackexchange.com/a/25002

This is really a question of personal preference, but as others have mentioned, you are less likely to get into trouble with lookahead bias if the timestamp is set to that of the closing moment. If it is set to the opening moment, it is easier to accidentally observe the closing price at the opening 'time', which is a time at which the closing price could not have been known.

If you are writing your own candlestick generation code, and have room, you will find it helpful to record all of the open/high/low/close times.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

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