loop in Optimizer - page 2

 
What is your outcome exactly? Do you have the file? Is it empty or contains zero? Did you check logs for errors? Try the code from this article to see if there is a general problem.
 
Stanislav Korotky:
What is your outcome exactly? Do you have the file? Is it empty or contains zero? Did you check logs for errors? Try the code from this article to see if there is a general problem.

Hi Stanislav

I have problem to understand variable scope using OnTester, OnTesterInit, OnTesterPass events

During each pass in OnTester I get this value TesterStatistics(STAT_PROFIT) I would like to compare with previous pass value, on which variable could I store it?

If I use a global EA variable in each pass is set to init value that is 0 so it seems that I have to store it on a file or does exists a global variable existing only in tester scope?

 
Pier Gaetano Novara:

Hi Stanislav

I have problem to understand variable scope using OnTester, OnTesterInit, OnTesterPass events

During each pass in OnTester I get this value TesterStatistics(STAT_PROFIT) I would like to compare with previous pass value, on which variable could I store it?

If I use a global EA variable in each pass is set to init value that is 0 so it seems that I have to store it on a file or does exists a global variable existing only in tester scope?

sorry for bombarding You with may be stupid questions.. I have got a solution to my last problem now the next.. how to launch optimizer with the terminal already opened?
 

I suppose you should be able to store all values of interest in the custom file during OnTester. You did not provide more info about your problem with the file.

OnTester is a common event for MT4/MT5, while the other OnTesterXXX events are available in MT5 only. To understand these events you may take a look at my codes posted on Russian forums: here and here. I hope automatic translation can help you understand the text.

To launch multiple copies of terminal you should create multiple copies of work folders with terminal. I'm afraid if you try to launch the same instance more than once, it will be blocked on common files in use.

 
Stanislav Korotky:

I suppose you should be able to store all values of interest in the custom file during OnTester. You did not provide more info about your problem with the file.

OnTester is a common event for MT4/MT5, while the other OnTesterXXX events are available in MT5 only. To understand these events you may take a look at my codes posted on Russian forums: here and here. I hope automatic translation can help you understand the text.

To launch multiple copies of terminal you should create multiple copies of work folders with terminal. I'm afraid if you try to launch the same instance more than once, it will be blocked on common files in use.

Hi Stanislav,

so OnTesterInit(), OnTesterDeinit() and OnTesterPass() in MT4 are never triggered during tester?

Finally using the global variable I have got a solution to my problem, I will use an EA for optimizer (that will write the parameters values in global variables) and a second EA with same logic for automatic trading (that will use the parameter set in global variables)

On my VPS windows scheduler I have now 1 task running weekly staring on Monday at 1 AM for 5 days and re-runing every 4 hours : in cascade a script to reset optimized parameters then a script to calculate new parameters and finally a script  for auto-trading using last best parameters found. A bit complex configuration but I didn't find a better one  

Reason: