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?


Timestamp on open:

Timestamp on close:

  • $\begingroup$ If you plan to use the data for backtesting, make sure you don't use data that would not have been available in real time - otherwise it doesn't make much difference, does it? $\endgroup$ – assylias Mar 18 '16 at 12:43
  • $\begingroup$ @assylias: I am sorry, I don't think I understand your comment. When generating candlestick data, you use a stream of real-time ticks. Data is always the same, you just need to decide if you want to put the timestamp on-open or on-close in the candles. My question is why should I choose one over the other. $\endgroup$ – Peque Mar 18 '16 at 12:49
  • $\begingroup$ What I meant is that if you store the data for candlestick 00:00-00:01 with a timestamp of 00:00 and you use that data for backtesting purposes - you may assume that you can send an order at 00:00 based on the information contained in that candlestick, which is obviously not the case. In my experience, the timestamp is generally the end of the period (00:01). Do you have examples of feeds which use the opening time as a timestamp? $\endgroup$ – assylias Mar 18 '16 at 12:53
  • 1
    $\begingroup$ @assylias: Interactive Brokers, Oanda (not documented or I didn't find it, but I know from experience), Metatrader they put the timestamp on open. When you create your own backtesting tools, you can always take that into account (and that's why IB and Metatrader's backtesting tools work as expected, no matter if they put the timestamp on open). $\endgroup$ – Peque Mar 18 '16 at 13:12

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.

| improve this answer | |

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.

| improve this answer | |
  • $\begingroup$ Could you please back-up your "is the de-facto standard" argument with some references/links? As you can see in the references section in my question, 3 tools out of 4 that I tried where using timestamp on open, rather than on close. $\endgroup$ – Peque Mar 21 '16 at 9:10
  • $\begingroup$ Also, it seems that NinjaTrader disagrees with you in "There is no particular advantage to either method". It seems for them it is better to use on-close "to plot multiple series of differing time frames within a single chart all accurately synchronized to time". $\endgroup$ – Peque Mar 21 '16 at 9:29
  • $\begingroup$ The "de facto" standard relates to my experience as a daily data vendor and how data is presented to us from different institutional-level data feeds. For various items, the timestamp given is the close timestamp. It may be that we are biased to longer timeframes data (such as weekly/quarterly). In accounting terms, the fiscal ending timestamp is the appropriate one to use (eg. companies that have a fiscal year boundary of March would refer to the current fiscal year as the "2016 fiscal year"). $\endgroup$ – Norgate Data Mar 21 '16 at 9:39
  • $\begingroup$ *ending last day in March $\endgroup$ – Norgate Data Mar 21 '16 at 9:50
  • $\begingroup$ Also note that some data points actually arrive some nanonseconds/millseconds/seconds/minutes after "the closing bell". For example, the official close of NYSE:GE is transmitted to the tape somewhat after 16:00:00.00000 New York time due to the way the DMMs aggregates various trades for the official close. $\endgroup$ – Norgate Data Mar 21 '16 at 9:57

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).

| improve this answer | |
  • $\begingroup$ Could you please provide a link/reference proving that Bloomberg actually uses the timestamp on close? Preferably official Bloomberg documentation. $\endgroup$ – Peque Mar 21 '16 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.