Catch the the error before it happens and let OnTester() return a unreal big number. Then this configuration will be placed at the very top of the results. The you can run this in a single pass.
Hi, but to catch the error i need to find which line of code it occured at.
- I thought you were asking for the special configuration as function line and column are logged: "OnTester function (array out of range, module Experts\XXXX.ex5, file XXXX .mq5, line 4013, col 72)"
- Do you know/have the source code?
- Most probably there is an array, so check the access.
- I thought you were asking for the special configuration as function line and column are logged: "OnTester function (array out of range, module Experts\XXXX.ex5, file XXXX .mq5, line 4013, col 72)"
- Do you know/have the source code?
- Most probably there is an array, so check the access.
yeah i did check the source code. the wierd thing is that the line number is not within the ontester function.
unfortunately even when i tried to catch the error before it occured, it was not caught. I am not sure what other way is there to find out the pass in which this error occured. Does anyone know how they solved such issue?
is there a log file stored for every pass?https://www.mql5.com/en/docs/runtime/errors
program is terminated immediately.
1. When it is terminated is deinit function called or not? Is ontester method called?
2. Why is array out of range error not present in these errorcodes?
https://www.mql5.com/en/docs/constants/errorswarnings/errorcodes
- www.mql5.com
yeah i did check the source code. the wierd thing is that the line number is not within the ontester function.
Line numbers belong to specific files - exactly as reported. No one could debug a code if errors would be marked by hypothetical line number of combined source codes with all includes (for which order of includes are even hard to follow).
According to your words, the error occured somewhere on the stack during OnTester event handler call, so your words that the problematic lines do not called from OnTester seems incorrect.
If you have the source code, just find the line and make sure (through edit) the access to an array is protected with index checkup.
If you don't mind to use autotranslation from Russian, then there is a solution for finding out problematic passes during optimization.
- 2025.02.22
- www.mql5.com
I have found the issue and fixed it. It was in a different method than ontester.
The line number was indeed correct although it was a bit tricky to troubleshoot since i didnt know that performing testerstop call doesnt stop the program immediately but waits for the whole tick to be processed, it took me a while to figure that out and then fix the issue.
But the method ontester is misleading, atleast in my case it was misleading, i dont know why.
Anyways issue resolved.
thanks for the link ill check it out
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
During certain pass while performing backtest using genetic algo and custom max criterion i got error:
genetic pass (0, 110) tested with error "critical runtime error 502 in OnTester function (array out of range, module Experts\XXXX.ex5, file XXXX .mq5, line 4013, col 72)" in 0:00:02.762
1. How can i find this genetic pass configuration so that i can reproduce the error and fix it?
2. Is there a log file created for each genetic pass? Where would that be kept?
3. Also i am using few mqh header file with some logic in this XXXX.mq5 EA file. Does the 4013 line number refer to the line within XXXX.mq5 file or the line number within combined logic once headers are included in XXXX.mq5 file?