Hi, I observe the optimizer in MT5 getting slower and slower over time. At first, it shows to need 20 hours for 10000 runs. After 2000 runs it shows 600hrs .
Quite often, when all agents are done, the optimizer waits and waits before it starts the next iteration.
Is there anything I can check in order to make it work faster?
for sure you can make your code to work faster, but issue is there and time increases in a polynomial manner.
I asked for but nothing to do more.
- 2024.01.04
- www.mql5.com
for sure you can make your code to work faster, but issue is there and time increases in a polynomial manner.
I asked for but nothing to do more.
For me, when running optimization, the estimated time is quite accurate. Have you tried freeing resources as well as dynamically allocated memory in OnDeinit()?
For me, when running optimization, the estimated time is quite accurate. Have you tried freeing resources as well as dynamically allocated memory in OnDeinit()?
Thank you. Yes, but I am not sure if I free ALL ressources.
I currently assume, that if there is not log message about a memory leak, then all ressources are cleared?
Is there a way to verify that?
I currently assume, that if there is not log message about a memory leak, then all ressources are cleared?
Honestly, I do not know if we need to release memories end of each opt steps or they will automatically!?
based on what Le Minh said, if we release dynamic resources in OnDeinit function, there will not be any accumulation of source! Or at least I understand this from his response. I am waiting for his re-response to my next question.
Forum on trading, automated trading systems and testing trading strategies
Optimizer getting slower and slower
Le Minh Duc, 2024.01.28 04:13
For me, when running optimization, the estimated time is quite accurate. Have you tried freeing resources as well as dynamically allocated memory in OnDeinit()?
Honestly, I do not know if we need to release memories end of each opt steps or they will automatically!?
based on what Le Minh said, if we release dynamic resources in OnDeinit function, there will not be any accumulation of source! Or at least I understand this from his response. I am waiting for his re-response to my next question.
Yes I tried :)
For resources that you use the ...Create() method, you should release them. For example, IndicatorCreate(), ResourceCreate()... When you don't use them anymore, use functions like IndicatorRelease(), ResourceFree(). Or dynamically allocated Arrays using the ArrayResize() method, when you don't use it . Instances are initialized with the keyword "new" and pointers can be released with "delete".
You can refer more here: https://www.mql5.com/en/docs/basis/variables/object_live
- www.mql5.com
The issue where multiple agents finish optimizing, but some remain in the process percentage, causing a wait for those slower agents, is something I found to be due to the EA using some parameter set during optimization that causes it to take a long time to process. For example, placing a large number of orders, being unable to place orders and waiting idly until the test optimization period is over, etc.
Personally, I initially addressed this by using various methods to terminate, such as:
OnTester - Every 1 minute:
- If the current balance is < 40% of the initial balance (oninit), terminate. {Excessive drawdown}
- If the open orders > 50 and the oldest order has been open for more than 1 week and still hasn't closed, terminate. {Too many open orders held for too long}
- If open orders > 200, terminate. {Too many open orders}
Every 2 months:
- If the balance < initial balance (oninit), terminate. {Growth is too slow}
- If there are no positions in order close, terminate. {Too few orders}
- If the number of closed orders in this period < 2 orders, terminate. {Too few orders}
Or any conditions you think might apply to your EA and cause it to be slow.
if that specific agent does not meet any of the specified cases but takes too long to process, use the function GetTickCount64() to count from when the EA was placed in milliseconds, and if it takes too long, terminate.
like ...
int Tester_elapetimetickmilli = 2; ulong millitick_startTime; ulong millitick_elapsedTime; millitick_elapsedTime = GetTickCount64() - millitick_startTime; if (millitick_elapsedTime >= (Tester_elapetimetickmilli) * 60 * 1000) { // terminate ... } // If processing takes longer than 2 minutes, terminate
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I observe the optimizer in MT5 getting slower and slower over time. At first, it shows to need 20 hours for 10000 runs. After 2000 runs it shows 600hrs .
Quite often, when all agents are done, the optimizer waits and waits before it starts the next iteration.
Is there anything I can check in order to make it work faster?