You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi!
I've an EA that creates some objects on the graph. These objects have fixed names saved in string arrays inside a struct. When OnDeinit is called, I call a function with a for loop that goes to ObjectFind every drawn object and, once located, ObjectDelete them. After that, I call ChartRedraw.
Unfortunately not always the process works. For some reason, some times when I remove the EA (thus calling OnDeinit AFAIK), at least some objects keep on the graph. And I don't understad why that happens.
My problem seems similar to this post: https://www.mql5.com/en/forum/138271 . In his case, though, it seems the problem was that the objects weren't always been created with the exact same name, thus the strategy with the #define worked. For me that's not the case: not only the objects are previously created inside an init() function and assigned to a specific name, so their names never change during the running of the EA, but when I get this problem and ask the Terminal to list all objects, there my remaining objects are with the correct names. So no errors there.
Here is the basic cleanup code:
glActualNumOfOps has value assigned only once in the OnInit function. Same with glChartID.
Could it be that ObjectFind is buggy? And thus I should move to the same iteration algorithm used in the mentioned forum thread?