Expiration date on Tester Execution

 

Is there the possibility in mt4 coding, to insert an expiration date, but not in realtime() executions which is possibile thanks to TimeCurrent() or other time functions, but on tester() execution so that also the tester will be blocked?

I know that it is possible to block the tester in other ways, but since the TimeCurrent() TimeLocal() and TimeGMT() time functions become equal during test execution, it may be impossible to have any reference to the current time and so to put an expiration date. 

Does anyone know a solution?

Thanks for reading my question..

 

It's hard to get this date. I've seen a hack with a call to kernel32.dll (google timegmt). My idea is to create a temporary file and read its creation date with FileGetInteger(), but I don't know if this works.

Edit

Seems to work. I left out the error checks.

int OnInit()
  {
   FileDelete("tmp");
   int fh=FileOpen("tmp",FILE_WRITE);
   datetime now=(datetime)FileGetInteger(fh,FILE_CREATE_DATE);
   FileClose(fh);
   FileDelete("tmp");
   if(MQLInfoInteger(MQL_TESTER) && now>=ExpirationDate) { Print("testing period expired"); return INIT_FAILED; }
   return INIT_SUCCEEDED;
  }
 
lippmaje:

It's hard to get this date. I've seen a hack with a call to kernel32.dll (google timegmt). My idea is to create a temporary file and read its creation date with FileGetInteger(), but I don't know if this works.

Edit

Seems to work. I left out the error checks.

I thank you so much... It works perfectly... :) 

Reason: