You're reading...
EA development, MQL4, Operations

Issues when determining GMT Offset using Windows system time

A quick post 2012-02-07:

I use the GetTimeZoneInformation function in the Kernel32.dll library to pull my system’s time, and hence calculate the broker time and consequently control my trading time window.

Earlier today, I entered one of my VPS’s that I use for testing and discovered the GMT offset was off by an hour. I was initially thinking that the broker changed it prematurely but then further investigation revealed that my system time was off by 16 minutes, and due to a rounding issue, this affected it. Attempts to correct it were unsuccessful as the time kept skipping back to the wrong one. Strangely enough, only one broker’s MT4 was affected (which was what lead me to the initial idea that it was the broker’s fault), with the other 2 brokers retaining a correct offset.

Take home message is, even though you may have done everything correctly, some external factor can fly in and royally screw up your system. I’ve made it a point to manually set my GMT offset after verifying it separately online.

Update 2012-02-15:

Same VPS is now 10 minutes fast this week. Irony is that  it actually becomes somewhat useful for failure-testing. But definitely not for using on real money accounts.

Update 2012-04-09:

I’ve discovered that even if you have your Windows time set to sync with an ntp server (Under Windows Date and Time Properties, the “Automatically synchronise with an Internet server” box is checked), there may be a possibility that your Windows Time service is NOT running. When this is the case, clicking on the “Update Now” box will give an error message “An error occurred getting the status of the last synchronization. The RPC server is unavailable.” (Remote Procedure Call)

To get around this, you’ll basically need to activate it.
Go to the MS-DOS command prompt via the Start Menu button -> Run, type in “cmd” and click OK.

You will get to this window.

Type in “net start” and press Enter, and you will get a list of network services running. If you faced the error issue above, you will note that Windows Time is not on the list.

To activate it, type in “net start w32time” and Enter, and you should see the below text.

Type in “net start” and Enter again, and you should now see that the Windows Time service is started.

Type “exit” and Enter, to exit the MS-DOS window.

Now, return to your Date and Time Properties window, and click the Update Now button. You should see this.

And if successful, then this.

Miscellaneous: You can use any of listed ntp servers, it doesn’t necessarily have to be the Windows one.

1. Post by Wesley Vogel on Wed May 02, 2007 at the Windows Users Group Network forum.
2. Windows Services List


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



Flag Counter
%d bloggers like this: