TimeGMT() ERROR

 

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:

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!

 
robertsimonuy:

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):

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

Look at my hosted server journal notes:

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!

are you running this EA on PC or VPS?
if VPS, check VPS local time.

 
Mohamad Zulhairi Baba:

are you running this EA on PC or VPS?
if VPS, check VPS local time.

On VPS. The VPS i use is from this website - Mql5. On mt4, there's a register vps button, that's what im using.

Anyway, what does local time have to do with TimeGMT()? Whatever the local time is, the function should output the GMT() equivalent, right?
 
robertsimonuy:
On VPS. The VPS i use is from this website - Mql5. On mt4, there's a register vps button, that's what im using.

Anyway, what does local time have to do with TimeGMT()? Whatever the local time is, the function should output the GMT() equivalent, right?
TimeLocal() is not necessarily the same as TimeGMT().
Check the difference in coding.
Reason: