Hello all. I'm currently optimizing my EA. After 5 passes, I have 5 optimization results. However, the next passes are running extremely slow. I have tried restarting it multiple times, but I can't move forward with optimization. If it is because of my code, then I don't know why the first few passes run quickly. There is nothing in the journal that would suggest anything. The only section of my code that is different than other EA's I have optimized before successfully is this: (Note- bid_array and time_array are declared as global variables)
Perhaps it has something to do with "deleting" tick data that is too old by using ArrayCopy()? And this is hazardous to the memory? I am not sure.
I would appreciate any help solving this problem, let me know if there is any more information from my terminal that would be helpful.
Can you post a screenshot of your settings for Strategy Tester please ?
EDIT: Where is this code executed ? in OnTick() ?
Can you post a screenshot of your settings for Strategy Tester please ?
EDIT: Where is this code executed ? in OnTick() ?
Yes, this code is executed in OnTick(). Here is a screenshot of the Settings Tab in the strategy tester. Also, I tried optimizing the MACD sample from metaquotes, it runs just fine.
There is the journal. Where it says "stopped by user" is when I stopped the running optimization of the MACD sample.
Right now, the agents are processing tasks at about 0.1%/half hour. This is much slower than the first 4 tasks.
Yes, this code is executed in OnTick(). Here is a screenshot of the Settings Tab in the strategy tester. Also, I tried optimizing the MACD sample from metaquotes, it runs just fine.
That comes probably from your code, but I don't know why only after 5 passes.
Anyway as your code is executed on each tick, seems to me that makes a lot of work. Maybe you can start a profiling (in MetaEditor) to see how your code is ran and eventually detect bottleneck. What is the actual size of your arrays ?
That comes probably from your code, but I don't know why only after 5 passes.
Anyway as your code is executed on each tick, seems to me that makes a lot of work. Maybe you can start a profiling (in MetaEditor) to see how your code is ran and eventually detect bottleneck. What is the actual size of your arrays ?
The size of the arrays are usually only about 10-30 elements. I ran this chunk of code in a data_tester EA, printing the size of the arrays and the latest elements each time to make sure it functioned correctly. It seemed to run fine. Huh. I guess I'll learn about profiling. Please let me know if you have any other suggestions.
As your problem arises after 5 passes, may be the problem comes from your optimization parameters. How can they influence your arrays, or others portions of your code ?
What is the mean time for the 5 first passes ?
As your problem arises after 5 passes, may be the problem comes from your optimization parameters. How can they influence your arrays, or others portions of your code ?
What is the mean time for the 5 first passes ?
This was exactly the issue, angevoyageur, thank you for putting me on the right path. The issue came from this section of code:
datetime seconds_elapsed=time_array[ArraySize(time_array)-1]-time_array[i]; MqlDateTime time_struct; TimeToStruct(seconds_elapsed,time_struct); if (time_struct.sec>MaxSeconds)
I forgot that time_struct.sec would not take into account if the seconds were more than 60.
Anyways, thank you for your great help.
This was exactly the issue, angevoyageur, thank you for putting me on the right path. The issue came from this section of code:
I forgot that time_struct.sec would not take into account if the seconds were more than 60.
Anyways, thank you for your great help.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all. I'm currently optimizing my EA. After 5 passes, I have 5 optimization results. However, the next passes are running extremely slow. I have tried restarting it multiple times, but I can't move forward with optimization. If it is because of my code, then I don't know why the first few passes run quickly. There is nothing in the journal that would suggest anything. The only section of my code that is different than other EA's I have optimized before successfully is this: (Note- bid_array and time_array are declared as global variables)
Perhaps it has something to do with "deleting" tick data that is too old by using ArrayCopy()? And this is hazardous to the memory? I am not sure.
I would appreciate any help solving this problem, let me know if there is any more information from my terminal that would be helpful.