Metatrader Overview – Time Zone Correction

It is quite often that a trader is to perform a time synchronization task when expert advisor is working. Prohibition or permission for orders opening in certain time spans during 24 hours, cancellation of suspended orders after certain time, prohibition against work of the expert advisor on holidays, trade permission only at news-time etc. may be required.

Time in Metatrader 4 client is read from server and depends on the broker configuration. Normally, time on the broker server is his local time. Metatrader 4 has no means for determination or automatic adjustment of the time zone. There is a possibility at our disposal to know the server time and local time of the computer on which Metatrader 4 client is working. Accordingly, if we use such dimensions as hours, minutes or even specific dates then we have to provide correspondence between local time and time on server. This task is owned by trader, while the programmer considering the above limitations can provide only the means for configuration.

With respect to zero meridian, time can have a shift of -12 to +12 hours. I.e. within 24 hours. However, two dates fall within this span. These are the current date (from 0 to +12) and previous date (from -12 to 0).

Let’s take a look at an example.

Expert advisor has to work only during the session at NYSE. NYSE is opened at 9:30 AM and closed at 4:00 PM as per Eastern Time. If the time will be converted to Greenvich Mean Time, then we will have GMT-5. We have to configure the expert advisor to work during this time. If we are located at the GMT-0 zone, then for correct synchronization we have to know our location with respect to zero meridian as well. E.g., our time zone is GMT+1. Thus, time difference makes up 6 hours. As the reference point is time on the side of the Metatrader 4 terminal, then the relative time shift will be -6 hours.

Let’s move on to specific figures and computations. Local time on trader’s computer is 2:00 PM. We find the time in New York by shifting the current time 6 hours back. We get 8:00 AM. It is too early for the expert advisor to operate; the stock exchange is not opened yet. The exchange will open when the local time will be equal to 3:30 PM.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *