Problem wiith tome zone

 
Hello everyone. I am doing backtesting which takes into account previous and current day's lows and highs. I downloaded the ticks from QuantDataManager but they are utc, and the broker I want to trade on is gmt+3 (icmarket).

How can I solve this? Thank you very much 
 
Use ConvertTimeForPlace() from TimeZoneInfo.mqh
See examples on the codebase page.

https://www.mql5.com/en/code/48419

datetime converted = CTimeZoneInfo::ConvertTimeForPlace(ticktime, ZONE_ID_UTC, ZONE_ID_BROKER);

This will handle conversions take into consideration, ICMarkets GMT offset and daylight changes on the server.

For backtesting additionally,  include TimeGMT.mqh library

Local Timezones and Local Session Hours
Local Timezones and Local Session Hours
  • www.mql5.com
Class to access to the local time for the specified location, as well as time zone information and the local trading session hours.
 
amrali #:
Use ConvertTimeForPlace() from TimeZoneInfo.mqh
See examples on the codebase page.

https://www.mql5.com/en/code/48419

This will handle conversions take into consideration, ICMarkets GMT offset and daylight changes on the server.

For backtesting additionally,  include TimeGMT.mqh library

Thank you very much! I had already seen that library but I didn't know it included that function.


I have one last question, does ConvertTimeForPlace() include the DST? or do you have to do some other configuration?


I literally just need to identify that I am in x utc time.


thanks again.

 
Fernando Andr Pelaez Menendez #:


I have one last question, does ConvertTimeForPlace() include the DST? or do you have to do some other configuration?


No configurations needed at all. DST will be handled automatically.

All you need to do is to make sure the time conversions are done on the broker's terminal (ICmarkets in your case).

Just follow the examples on the codebase, sure you will find one that fits your needs. 


Edit:

Additional details:

Your broker is GMT+2 standard time (and GMT+3 in summer), the broker follows the US daylight savings schedule.

DST_US : server dst begins on the second Sunday of March (+1) and ends on the first Sunday of November (-1).

All these details are handled automatically.

 
amrali #:

No configurations needed at all. DST will be handled automatically.

All you need to do is to make sure the time conversions are done on the broker's terminal (ICmarkets in your case).

Just follow the examples on the codebase, sure you will find one that fits your needs. 


Edit:

Additional details:

Your broker is GMT+2 standard time (and GMT+3 in summer), the broker follows the US daylight savings schedule.

DST_US : server dst begins on the second Sunday of March (+1) and ends on the first Sunday of November (-1).

All these details are handled automatically.

You are incredible! Thx!!!