How to deal with different system timezone (when next day occurs)


I'm using AmiBroker in a different timezone than EST, so at around 1:30pm EST, my system time will be 2 hrs past midnight - i.e. 2:XXam - essentially it's the next day.

Because of this, the lines of previous day high/low/close/open etc., are messed up. I tried changing the timeshift in the database settings, but that only affects the time I see on the charts - Now() still returns local time.

Is there a way to change AmiBroker's timezone settings (such that Now() returns EST or exchange time) without changing my PC's timezone?

You may use DateTimeAdd() function.

/// Shift Now DT back by set hours
hoursShift = -13;
nowDT_shift = DateTimeAdd(Now(5), hoursShift, inHourly);
nowDT_str = DateTimeToStr(nowDT_shift);
printf( "Shifted Now(5): %s", nowDT_str);

If you need timenum instead of datetime then insert shifted datetime within DateTimeConvert().


How does this help the problem I have?

For example, a sample of my code is:

	yDayH = TimeFrameGetPrice("H", inDaily, -1);// yesterdays high 
	yDayL = TimeFrameGetPrice("L", inDaily, -1);//yesterdays low 
	yDayC = TimeFrameGetPrice("C", inDaily, -1);//yesterdays close 
	yDayO = TimeFrameGetPrice("O", inDaily, -1);//yesterdays open 
	cDayO = TimeFrameGetPrice("O", inDaily);// current day open 
	cDayH = TimeFrameGetPrice("H", inDaily); 
	cDayL = TimeFrameGetPrice("L", inDaily); 
	style = styleDashed; 
	rcolor = colorBlue; 
	scolor = colorRed; 
	pcolor = colorGreen;	
	Plot(yDayH, "\ny_high",colorPaleGreen,styleDots);
	Plot(yDayL, "y_low",colorCustom14,styleDots);
	Plot(yDayO, "y_open",colorAqua,styleDots);
	Plot(yDayC, "y_close",colorTeal,styleDots);

I'm not sure how DateTimeAdd can be used here?

5 posts were split to a new message: Inappropriate exchange between jsmith and fxshrat removed from thread

Since you have not added any info about what are your data base settings anywhere in this thread we have to play guessing games again.

Apparently you have set to Exchange time in
File - Data base settings - Intraday settings - Daily Time compression uses.

So set to Local time.
Then the lines should adjust as well.

Read how to ask good question

Moderator comment: the remaining offending part of the post has been removed

You need to read the Knowledge base article and adjust the settings accordingly:

This allows among other things to have daily quotes the way you like it.


The thread is now closed because recent "exchange" between two posters was going into wrong direction (not following forum rules). Inappropriate exchange was removed from thread (and placed into "private" channel between @jsmith and @fxshrat).