Automated Testing

 

Is it possible to call the tester for optimization from the EA? 

 What I want to do is re-optimize every weekend after the market has closed. I can use

 MqlDateTime str1;
 TimeToStruct(TimeLocal(),str1);

if (!selfoptimize) return;
if (str1.day_of_week!=selfoptimizeday) return;

  to check for the weekend, and can read and write the data files pretty easy. But I am at the point where I either need to write the code to loop through the history and the parameters, or use some built-in functions.

I have been searching the forum and the documentation for the past couple of hours with very little success. I did find this topic but is just dancing around the information enough to keep me searching.

Any help or links would be appreciated. 

 

As I understand, you can't call the tester from your EA, but you can automatize the process of optimization by automatically start the plateform with all necessary informations to do it.

Seems to me that all necessary info are in the topic you point to. However I have not tried.

 
CappinJack:

Is it possible to call the tester for optimization from the EA? 

 What I want to do is re-optimize every weekend after the market has closed. I can use

  to check for the weekend, and can read and write the data files pretty easy. But I am at the point where I either need to write the code to loop through the history and the parameters, or use some built-in functions.

I have been searching the forum and the documentation for the past couple of hours with very little success. I did find this topic but is just dancing around the information enough to keep me searching.

Any help or links would be appreciated. 

Is this what you're looking for OnTester ?, There are several topics about that in forum.
 
phi.nuts:
Is this what you're looking for OnTester ?, There are several topics about that in forum.
Thanks for the link, but I still think OnTester is just the event handler when the strategy tester is run. What I am trying to do is automatically start the  strategy tester from code. I see where I can set up the data files for the strategy tester to use. I just can not figure out how to call it and put into action.
 
CappinJack:
Thanks for the link, but I still think OnTester is just the event handler when the strategy tester is run. What I am trying to do is automatically start the  strategy tester from code. I see where I can set up the data files for the strategy tester to use. I just can not figure out how to call it and put into action.
Nope, we can NOT call the tester from EA, CI or Script - but we can call it using some Win API program :(.
 
phi.nuts:
Nope, we can NOT call the tester from EA, CI or Script - but we can call it using some Win API program :(.
Bummer, thats what I was afraid of. Looks like I need to get to work and code it.  Thanks for your time.
 
CappinJack:
Bummer, thats what I was afraid of. Looks like I need to get to work and code it.  Thanks for your time.

You could setup a scheduled task to run on the weekends, the EA that you are testing could have a DLL that communicates to a DB to store the results, or when the task finishes you could have an app that analyzes the results and stores it in the DB. I'm not sure how you capture results from running the tester on the command line, but one of these methods should work. Your main EA could then call info from the DB based on the last best result ran.

I have been thinking about doing something similar for a while, let us know how this goes for you.  

 
paysonwelch:

You could setup a scheduled task to run on the weekends, the EA that you are testing could have a DLL that communicates to a DB to store the results, or when the task finishes you could have an app that analyzes the results and stores it in the DB. I'm not sure how you capture results from running the tester on the command line, but one of these methods should work. Your main EA could then call info from the DB based on the last best result ran.

I have been thinking about doing something similar for a while, let us know how this goes for you.  

Now you have me interested.... I know I can manipulate the tester results within the EA with the TesterPass event. But..how do you call the strategy tester from the command line. If I understand that, I am sure I can write something within visual basic to call it once a week. Any Ideas??
 
CappinJack:
Now you have me interested.... I know I can manipulate the tester results within the EA with the TesterPass event. But..how do you call the strategy tester from the command line. If I understand that, I am sure I can write something within visual basic to call it once a week. Any Ideas??
Follow the link that you posted  . . .  and you will find this:  https://www.metatrader5.com/en/terminal/help/start_advanced/start
 

actually, there is a possibility to do the self-optimization from EA, but the cost might be high:
you have to rewrite the complete code as you will not use the existing strategy tester, but your own.

Check this.

Also, i haven't checked it out, but there is a possibility that OnTimer() is started as a parallel thread, which would be a solution as well.

I have a plan for self-optimizing indicator, but it is still not scheduled for realisation:
It would use OnTimer() for one pass of testing, with a shorter back-test period, so that it would be finished within 1 second, and thereby not interfering with the rest of the system, especially if it would be run from EA as second thread as described in article above.

 
graziani:

actually, there is a possibility to do the self-optimization from EA, but the cost might be high:
you have to rewrite the complete code as you will not use the existing strategy tester, but your own.

Check this.

Also, i haven't checked it out, but there is a possibility that OnTimer() is started as a parallel thread, so this could be also useful.

I have a plan for self-optimizing indicator, but it is still not scheduled for realisation.

While the article is interesting, it talks about the parralélisation tasks, and I do not see the link with the question addressed in this topic.

Also why not use the existing strategy tester, and build your own ? To solve what problem ?


Reason: