1

Why is my EA not giving me the right time? here is my code (I omitted a lot of stuff that i dont think contribute to the problem):

void OnTick() {
  static int OpenHour=99;

  if(OpenHour!=TimeHour(TimeGMT())){
     OpenHour=TimeHour(TimeGMT());

     if(OpenHour==8){
     //some codes here
     //execute order
     }
  }
}

The problem is, my server executes my trades on 7am GMT instead of 8am!

Look at my hosted server journal notes:enter image description here

Notice how at 10AM SERVER TIME, my EA executed the sell stop trade. 10AM server time is 7AM GMT! I know this because right now, it says on the chart it's 12:00, and it's currently 9AM GMT. Therefore, 8AM GMT should be 11AM not 10AM!

  • you can send a message to the service desk at mt5.com. Or you may check the time difference. I just checked and it works ok at my end – Daniel Kniaz Aug 11 '18 at 07:40
  • It's a tricky problem. As you wrote, it seem that you are on a hosted server. In this case you have many different time settings. 1. The local time at the place of the server, so if it's cloud based, it's far from obvious what time-zone (TZ) that is. 2. The TZ settings on the server. 3. The TZ setting in the MT4 Terminal. 4. The time or TZ used in your EA program. 5. The TZ of the broker server that your Terminal is connected to. 6. Last but not least, is the TZ used, using Daylight Saving Time (DST)? – not2qubit Aug 16 '18 at 03:40
  • I ended up just using the brokers time and using an input integer to offset the time for gmt. The problem with this is, i have to constantly change the offset parameter everytime the dst changes. – Robert Simon Uy Aug 23 '18 at 07:56

0 Answers0