Or you could just hard-code an offset from the server time, and allowing for daylight savings if required.
That would only work if I used a global to get an access time which gives me the brokers local time.
int a =1;
int gmt_offset =7; // difference between TimeCurrent()-TimeLocal() in hours
int time_local=GlobalVariableSet("a",a)-gmt_offset*3600;// 7 hour offset between my computer and interbank
It would work, but that's not good if I want to give my program to someone who uses a different broker or in a different time zone. There has to be a proper way to do this.
datetime TimeLocal()
Note: At the testing, local time is modeled and is the same as the modeled last known server time.
Is there a way using a windows dll (maybe "shell32.dll" ) to get the local time during a test.
Please have a look on this indicator script 'Clock v 1.3'. It use kernel32.dll to pick up the system time. Hope this may help.
Please have a look on this indicator script 'Clock v 1.3'. It use kernel32.dll to pick up the system time. Hope this may help.
Excellent this is exactly what I was looking for thank you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
datetime TimeLocal()
Note: At the testing, local time is modeled and is the same as the modeled last known server time.
Is there a way using a windows dll (maybe "shell32.dll" ) to get the local time during a test.