Offset in hourly multi-timeframe data

Hi, I am using hourly candle data in my strategy, which runs on 5 minute data. I use amibroker for optimization of parameters, and run my strategy in another program. The problem I'm having is this - in amibroker, the hourly candle data changes 30 minutes after the hour. In the program I use for automated trading, the hourly candle data changes on the hour.

To view the hourly close price using "explore" I have this in my code:

TimeFrameSet( 3600 )
c1h = C;
TimeFrameRestore();    
c1h = TimeFrameExpand(c1h,3600); 
Filter=1;
AddColumn(C,"Close",format = 1.6);      
AddColumn(C1h,"1 Hour Close",format = 1.6);    

Amibroker output:

Date/Time Close 1 Hour Close
2019-05-18 11:55:00 PM 7260.100098 7261
2019-05-19 00:00:00 7277.700195 7261
2019-05-19 12:05:00 AM 7280 7261
2019-05-19 12:10:00 AM 7291.933105 7261
2019-05-19 12:15:00 AM 7278.5 7261
2019-05-19 12:20:00 AM 7278.899902 7261
2019-05-19 12:25:00 AM 7293.799805 7293.799805
2019-05-19 12:30:00 AM 7299.935059 7293.799805
2019-05-19 12:35:00 AM 7290.200195 7293.799805
2019-05-19 12:40:00 AM 7290.100098 7293.799805
2019-05-19 12:45:00 AM 7303.200195 7293.799805
2019-05-19 12:50:00 AM 7300.100098 7293.799805
2019-05-19 12:55:00 AM 7300.200195 7293.799805
2019-05-19 1:00:00 AM 7307 7293.799805
2019-05-19 1:05:00 AM 7353.100098 7293.799805
2019-05-19 1:10:00 AM 7426 7293.799805
2019-05-19 1:15:00 AM 7483.799805 7293.799805
2019-05-19 1:20:00 AM 7506 7293.799805
2019-05-19 1:25:00 AM 7525 7525
2019-05-19 1:30:00 AM 7560.100098 7525
2019-05-19 1:35:00 AM 7550 7525
2019-05-19 1:40:00 AM 7562.100098 7525

My live-trading software looks like this:

date/time close 1 hr close
2019-05-19 00:00:00 7260.1000976563 7290
2019-05-19 12:05:00 AM 7277.7001953125 7260.1000976563
2019-05-19 12:10:00 AM 7280 7260.1000976563
2019-05-19 12:15:00 AM 7291.9331054688 7260.1000976563
2019-05-19 12:20:00 AM 7278.5 7260.1000976563
2019-05-19 12:25:00 AM 7278.8999023438 7260.1000976563
2019-05-19 12:30:00 AM 7293.7998046875 7260.1000976563
2019-05-19 12:35:00 AM 7299.9350585938 7260.1000976563
2019-05-19 12:40:00 AM 7290.2001953125 7260.1000976563
2019-05-19 12:45:00 AM 7290.1000976563 7260.1000976563
2019-05-19 12:50:00 AM 7303.2001953125 7260.1000976563
2019-05-19 12:55:00 AM 7300.1000976563 7260.1000976563
2019-05-19 1:00:00 AM 7300.2001953125 7260.1000976563
2019-05-19 1:05:00 AM 7307 7300.2001953125
2019-05-19 1:10:00 AM 7353.1000976563 7300.2001953125
2019-05-19 1:15:00 AM 7426 7300.2001953125
2019-05-19 1:20:00 AM 7483.7998046875 7300.2001953125
2019-05-19 1:25:00 AM 7506 7300.2001953125
2019-05-19 1:30:00 AM 7525 7300.2001953125
2019-05-19 1:35:00 AM 7560.1000976563 7300.2001953125
2019-05-19 1:40:00 AM 7550 7300.2001953125

So I'm ending up with indicator values that are different between the two, and my strategy isn't working correctly in the live trading version. Is there a way I can get the hourly close price to use the close price from 0:55 instead of the close from 0:25 with amibroker? It's not easily possible to do it on the live-trading software.

Thank you for the help

As mentioned already on the forum, the way candles are aligned depends on User Setting.
Tools->Preferences->Intraday and File->Database Settings->Intraday Settings : Trading hours.
If your day session trading hours are defined to begin on 9:30, then hourly bars would also begin in half an hour boundary IF align box is checked.

image

4 Likes

Great thanks for the info. I read the amibroker.com/guide/h_timeframe.html and this was not mentioned in there. Perhaps that would be a good place to put this information. Might save you some time in answering the same question over and over again too.

Actually it's quite the opposite. ( As in users are expected to check the settings including non-coders )

Even if you don't use TimeFrame functions, and just Plot any Symbol, you can see that the Hourly bar ( as in your case) will be aligned depending on the above setting OR the actual market hours defined in the DB settings ( or group intraday settings ).

It is covered in great detail in the manual already: http://www.amibroker.com/guide/w_preferences.html

If same information was repeated many times the manual would have 3000+ pages instead of current 1300+ and it would be (much) harder to swallow.

2 Likes

@cm111 - could you be anymore disrespectful! What a disgrace!

Maybe you should apologize to Thomasz or stop using AmiBroker and therefore stop using this great forum that Thomasz kindly provides and maintains?

By the way, his name is Thomasz not "Man"!

5 Likes

could you point out where the "disrespectfull" comment was made?, I can't find it... all I can see its that he was misinformed and made a sugestion based on that... I don't see any disrespectfull comment nor bad intentions...

Hi @Francisco,

The post/s in this thread that I was referencing where he was being disrespectful to @Tomasz and to this forum has since been deleted.

3 Likes

Apparently requesting updates to the user manual / documentation to make it easier to figure out how to use Amibroker without constantly asking questions on the forum because it's impossible to find the information you're looking for since it doesn't even show up in the index is "disrespectful" LOL! Apparently calling someone "man" is disrespectful! LOL!

@cm111,

In case you have forgotten, @Tomasz removed your post for a reason! So yes, you were being disrespectful!

And once again you are being disrespectful in this post!

You would have no idea how much time and effort @Tomasz spends writing the docs!

Maybe a little more effort is required from yourself to find what you are looking for???

@cm111 I see you are still seeking fresh assistance from this forum - not a good way to go about it! Other forum members will just ignore your questions - do you not realise that?

Actually, his name is Tomasz! :slight_smile: And, I apologize for being disrespectful. I greatly appreciate this amazing software and the community forum. Sometimes it can be a bit frustrating trying to find information or get assistance and the replies seem to be condescending, but in the future I will not get annoyed by that or be a jerk!