{"id":623,"date":"2014-10-25T03:36:09","date_gmt":"2014-10-25T08:36:09","guid":{"rendered":"http:\/\/www.amibroker.com\/kb\/?p=623"},"modified":"2014-12-03T07:58:38","modified_gmt":"2014-12-03T12:58:38","slug":"how-to-correct-forward-looking-timestamps","status":"publish","type":"post","link":"https:\/\/www.amibroker.com\/wordpress\/kb\/2014\/10\/25\/how-to-correct-forward-looking-timestamps\/","title":{"rendered":"How to correct forward looking timestamps"},"content":{"rendered":"

Some platforms, like Tradestation, use “future looking” timestamps in their data so for example 5 minute bar covering market activity from 9:30:00 till 9:34:59 is stamped with 9:35:00 (future time – see Tradestation manual explaining their timestamps<\/a>) so their data have a kind of future offset.<\/p>

AmiBroker, on the other hand, uses and expects natural timestamping, in which data from 9:30 are marked with 9:30 timestamp, so data from 9:30:00 until 9.34:59 belong to 9:30 5-minute bar.<\/p>

If you want to use future-timestamped data in AmiBroker you need to remove the offset.<\/p>

To do so, you need to shift the timestamps back by the amount equal to the base data interval during import process. In case of 5-minute bars, you need to shift data by -5 minutes. <\/p>

To shift the data during import you can use $TIMESHIFT command of ASCII importer, see http:\/\/www.amibroker.com\/guide\/d_ascii.html<\/a><\/p>

$TIMESHIFT offset_in_hours<\/em><\/code><\/p>

the offset_in_hours<\/em> parameter defines the time in hours that should be added to imported timestamps. You can use negative and fractional values too. Each minute is 1\/60 of hour so shifting back by 1-minute would be -0.01666667.<\/p>

If you are using ASCII Importer Wizard<\/a>, and want to import 5-minute data with future looking timestamps, you can simply type the following in the “Additional commands” box of ASCII Importer Wizard<\/a>.<\/p>

$TIMESHIFT -0.08333333333333<\/code><\/p>

-0.08333333 is a result of dividing 5 by 60 (number of minutes in an hour)<\/p>

Please find out what time-stamping method is used by your data provider because it is important to know that to get your higher-interval charts right.<\/p>","protected":false},"excerpt":{"rendered":"

Some platforms, like Tradestation, use “future looking” timestamps in their data so for example 5 minute bar covering market activity from 9:30:00 till 9:34:59 is stamped with 9:35:00 (future time – see Tradestation manual explaining their timestamps) so their data have a kind of future offset.AmiBroker, on the other hand, uses and expects natural timestamping, […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[54],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/623"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=623"}],"version-history":[{"count":3,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/623\/revisions"}],"predecessor-version":[{"id":644,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/623\/revisions\/644"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}