Optimzation on Remote Server fails

 

Hi guys,

Optimization of my EA on remote server fails with the following error:

2013.01.17 21:55:44    eagle    pass 8 tested with error "critical runtime error in global initialization function (error 508, module -1, file 65535, line 0, col 0)" in 15 ms

This is because of DLL call and that's fine. I therefore changed to code to only do DLL calls if the current run is not an optimization run:

if (!(bool)MQL5InfoInteger(MQL5_OPTIMIZATION)) OutputDebugStringA(OutputStringArray);

But the problem is that the Metatrader 5 Strategy tester is throwing an error reagardless. Just to check that the MQL5_OPTIMIZATION flag is working I changed to code to:

if (1==2) OutputDebugStringA(OutputStringArray);

and even that throws an error. Only if I comment that line out it works.

My question here is: Is there any way (maybe with some preprocessor calls) to "disable the row" so I don't need to keep 2 versions (ex5 files) of the same EA. One with DLL calls and one without?

Thanks,
Wolfgang

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Running MQL5 Program Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Running MQL5 Program Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Running MQL5 Program Properties - Documentation on MQL5
 
rgereal:

Hi guys,

Optimization of my EA on remote server fails with the following error:

2013.01.17 21:55:44    eagle    pass 8 tested with error "critical runtime error in global initialization function (error 508, module -1, file 65535, line 0, col 0)" in 15 ms

This is because of DLL call and that's fine. I therefore changed to code to only do DLL calls if the current run is not an optimization run:

But the problem is that the Metatrader 5 Strategy tester is throwing an error reagardless. Just to check that the MQL5_OPTIMIZATION flag is working I changed to code to:

and even that throws an error. Only if I comment that line out it works.

My question here is: Is there any way (maybe with some preprocessor calls) to "disable the row" so I don't need to keep 2 versions (ex5 files) of the same EA. One with DLL calls and one without?

Thanks,
Wolfgang

Sorry for late reply.

How about using MQL5 import 

All you have to do is to change the import .ex5 file from the one with .dll calling with the one that is not calling .dll. 

Reason: