London Break-out - page 3

 
gchrmt4:
How, using only the information which MT4 provides, do you know that the broker was on GMT+2 last week?


Because today, the offset to GMT is +3 with daylight saving adjustment, so last week, when broker was in standard time, the offset was +2.

The only difference is daylight saving time.

 
SDC:

The common sense approach would be for MT4 server to use GMT all the time but you know they aren't going to do that.


I think MT4 should encode time zone and daylight saving adjustment in its time structure. This would allow historical time to be used accurately. :)
 
Thirteen:


Because today, the offset to GMT is +3 with daylight saving adjustment, so last week, when broker was in standard time, the offset was +2.

The only difference is daylight saving time.

I'll put it another way: how, using only the information which MT4 provides, do you know that the broker moved to DST on the US schedule rather than the European schedule (or not at all)? How do you know that they're not currently on winter time and will move on March 30th?
 

gchrmt4:
[1] how . . . do you know that the broker moved to DST on the US schedule rather than the European schedule (or not at all)?

[2] How do you know that they're not currently on winter time and will move on March 30th? Or that they are not using constant GMTZ?
  1. As I stated in my first post, the broker stated it moves to DST on U.S. schedule, not EU schedule.
  2. Broker states it is GMT+2 during standard time. Plus, by using the new TimeGMT(), server offset to GMT can now be easily calculated.
 
Thirteen:
  1. As I stated in my first post, the broker stated it moves to DST on U.S. schedule, not EU schedule.
  2. Broker states it is GMT+2 during standard time. Plus, by using the new TimeGMT(), server offset to GMT can now be easily calculated.
That is not information which MT4 is providing. That is information which you are providing because you know which broker you are using. You could not e.g. give other people a piece of code to run on an unknown broker server which then reliably converted historical times to GMT (or, via GMT, to another timezone such as London).
 
gchrmt4:
That is not information which MT4 is providing. That is information which you are providing because you know which broker you are using. You could not e.g. give other people a piece of code to run on an unknown broker server which then reliably converted historical times to GMT (or, via GMT, to another timezone such as London).

... Taking us back to the OP, how do you propose to give them a code sample which will reliably run on whichever broker server he/she is using in order to determine London times and London prices?

The only point I have been trying to make all along is that, yes you can do conversions to GMT or other timezones if you know the origin offset, but MT4 provides no reliable alternative to asking for some sort of user input about the broker's time settings.

 

You can get the local GMT offset from Windows. Simple comparison will give you the brokers offset without asking for user inputs.

 
Thanks a lot for all comments! I will give an update when my EA is ready! with my learning curve for MQL4 I hope by the end of this year ;-)
 
Nour:
Thanks a lot for all comments! I will give an update when my EA is ready! with my learning curve for MQL4 I hope by the end of this year ;-)
from the link https://docs.mql4.com/series/ibarshift i gave you

Example:

datetime some_time=D'2004.03.21 12:00';
int shift=iBarShift("EURUSD",PERIOD_M1,some_time);
Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift);

when does London open what timezone is that ??

What was the brokertime today at opening time London ?? some_time= .................

What time did your broker had that moment....

 
Note that for any GMT calculations, backtesting often has to be handled differently to forward testing.
Reason: