Download MetaTrader 5

TimeGMT() issue while backtest?

To add comments, please log in or register
Find out how to install MetaTrader on Mac OS
Sherif Hasan
7290
Sherif Hasan 2016.10.20 11:10 

I run my EA om gmt time settings. but when i do backtest, eatakes local/server time?

what could be the issue? Is forward tests will work on GMT time?

datetime GMTDay = TimeGMT();
    int hour0 = TimeHour(GMTDay);
    int minute0 = TimeMinute(GMTDay);
    if (DayOfWeek() != Today && hour0 == 1 && minute0 == 1)
    {
        Today = DayOfWeek();
        
    }
Keith Watford
Moderator
9644
Keith Watford 2016.10.20 11:18  

From the documentation

During testing in the Strategy Tester, TimeGMT() is always equal to TimeCurrent() simulated server time.



Sherif Hasan
7290
Sherif Hasan 2016.10.20 11:55  
GumRai:

From the documentation


Thanks for your support GumRai, Is there any trick to see real GMT time while backtest? bcoz while i backtest with different ea it gives wrong trades due to mis trading time , when it takes server time.

Keith Watford
Moderator
9644
Keith Watford 2016.10.20 12:01  
sheriffonline:

Thanks for your support GumRai, Is there any trick to see real GMT time while backtest? bcoz while i backtest with different ea it gives wrong trades due to mis trading time , when it takes server time.


I doubt it. I have avoided using GMT time so far as most people don't understand what it is
Blahtech Limited
3626
James Cater 2016.10.20 14:37  
sheriffonline:

Thanks for your support GumRai, Is there any trick to see real GMT time while backtest? bcoz while i backtest with different ea it gives wrong trades due to mis trading time , when it takes server time.



Anything to do with GMT via the on MetaTrader functions is not quite what they seem because the GMT offsets are taken from your local machine settings not the MetaTrader server machine (where the chart candles are formed).

Therefore you have to be careful when applying any automatic GMT offsets or Daylight savings.

Carl Schreiber
6609
Carl Schreiber 2016.10.20 14:44  
sheriffonline:

.. Is there any trick to see real GMT time while backtest? ...

Have a list of dates of the USD-DST? Now if you are sure that your quotes always start on Forex-Open time (NY 17:00) you can calculate the GMT-Offset of your broker at the very first tick after the weekend.

Can't remember exactly but something like (first tick!!):  TimeCurrent() =  (BrokerOpenTimeGMT - BrokerGMTOffset) = NY_17:00 + USD-DST + NY-GMTOffset(+5h).

whroeder1
14532
whroeder1 2016.10.20 16:18  
sheriffonline: Is there any trick to see real GMT time while backtest?
No! You can change server time to GMT time using a constant offset, but you must verify server doesn't change DST during the run.
To add comments, please log in or register