Ran into something very strange. Issue:
If I run a single test on the same optimiser result 5 times, 2 out of the 5 times the result matches perfectly. The times it matches perfectly not a single error in the log. The other 3 times always the same error about INVALID_PRICE. Both optimiser and single test using "Every tick based on real ticks". How can one single run produce a perfect log and result, and the other times INVALID_PRICE issue. If it was a problem with my code, it surely would not produce a perfect log and match the optimiser result exactly multiple times.
I have read multiple forums here and implemented all suggested fixes into my code, including initialising global variables in the OnInit function.
what type of optimization are you running ?
are they all similar if you set the spread from floating to 1?
what type of optimization are you running ?
are they all similar if you set the spread from floating to 1?
Fast genetic based algorithm, have not tried on others.
If I set the spread to 1 instead of floating, wouldn't that make the test conditions different from the actual trading conditions during that period? Since the spread fluctuates in real-time, wouldn't a fixed spread potentially hide the issue rather than diagnose itFast genetic based algorithm, have not tried on others.
If I set the spread to 1 instead of floating, wouldn't that make the test conditions different from the actual trading conditions during that period? Since the spread fluctuates in real-time, wouldn't a fixed spread potentially hide the issue rather than diagnose itit will identify if the issue is there tho
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
I have read multiple forums here and implemented all suggested fixes into my code, including initialising global variables in the OnInit function.
Not only global variables but all variables/objects/etc must be initialized.
If you observe sporadic results for the same external conditions/settings, there is a randomness in your code.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Ran into something very strange. Issue:
If I run a single test on the same optimiser result 5 times, 2 out of the 5 times the result matches perfectly. The times it matches perfectly not a single error in the log. The other 3 times always the same error about INVALID_PRICE. Both optimiser and single test using "Every tick based on real ticks". How can one single run produce a perfect log and result, and the other times INVALID_PRICE issue. If it was a problem with my code, it surely would not produce a perfect log and match the optimiser result exactly multiple times.
I have read multiple forums here and implemented all suggested fixes into my code, including initialising global variables in the OnInit function.