duration.

 

How do you get local PC time for init() and deinit() to determine duration if backtesting?

Is a win32 api call necessary?

 
mrmedia:

How do you get local PC time for init() and deinit() to determine duration if backtesting?

Is a win32 api call necessary?


TimeLocal()
 
angevoyageur:

TimeLocal()


Nope,  "Note: At the testing, local time is modelled and is the same as the modelled last known server time."

 

mrmedia:

How do you get local PC time for init() and deinit() to determine duration if backtesting?

Is a win32 api call necessary? 

You could run a simple indicator on a live chart that writes TimeCurrent() or TimeLocal() to a GlobalVariable every 10 seconds or less frequently and then access this Global Variable from the EA running under the Strategy Tester . . . .  other than that you might need to use Win API
 
RaptorUK:


Nope,  "Note: At the testing, local time is modelled and is the same as the modelled last known server time."

 

You could run a simple indicator on a live chart that writes TimeCurrent() or TimeLocal() to a GlobalVariable every 10 seconds or less frequently and then access this Global Variable from the EA running under the Strategy Tester . . . .  other than that you might need to use Win API

 

Getting there 

#import "kernel32.dll"
     int GetSystemTime(int & arr8[] );  
   int GetLocalTime(int & arr8[] );     
#import

         int arroloc[7];
        GetSystemTime(arroloc ); 
        Print(" nowSystemTime " , arroloc[0], arroloc[1],arroloc[2],arroloc[3],arroloc[4],arroloc[5],arroloc[6],arroloc[7]);

         int arrolocB[7];
        GetLocalTime(arrolocB ); 
        Print(" nowLocalTime " , arrolocB[0], arrolocB[1],arrolocB[2],arrolocB[3],arrolocB[4],arrolocB[5],arrolocB[6],arrolocB[7]);

             Public Type SYSTEMTIME
                      wYear As Integer          1601 through 30827
                      wMonth As Integer         1-12 
                      wDayOfWeek As Integer     0-6
                      wDay As Integer           1-31  
                      wHour As Integer          0-23
                      wMinute As Integer        0-59
                      wSecond As Integer        0-59 
                      wMilliseconds As Integer  0-999
              End Type
nowLocalTime 
4607
6519
6611
1310
7235
6164
4040
 
nowSystemTime 
4607
6513
1074
1310
7395
6164
4040



 

https://www.mql5.com/en/code/8646

the dll contains a function MT_time(); which will return GMT maybe that helps

Reason: