The recompilation order is different, first it calls deinitialization, then initialization
I found the solution, but I believe there are better alternatives for this..
I put a sleep(5000).
Why? It is likely that within this time the indicator has been removed, so when you delete an indicator from the chart, you need to wait.
I just didn't think it was cool that I had to use sleep for it, I thought that ChartRedraw() would fulfill the function of processing an event queue that it would remove, but to no avail.
I put a sleep(5000).
Why? It is likely that within this time the indicator has been removed, so when you delete an indicator from the chart, you need to wait.
I just didn't think it was cool that I had to use sleep for it, I thought that ChartRedraw() would fulfill the function of processing an event queue that it would remove, but to no avail.

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
I have the following situation:
My EA creates a handler of any indicator, in the OnInit() function.
In the OnDeInit() function of my EA I call the functions: a clear for the memory data and another removal for the indicator:
Okay, at this point when I remove the EA from the chart it successfully removes the indicator.
The problem is when I recompile my system.. As far as I know, the recompile follows the following process:
EA:OnDeInit() > Indicator:OnDeInit() > EA:OnInit() > Indicator:OnInit()
But the process works differently:
EA:OnDeInit() > EA:OnInit() > Indicator:OnInit() > Indicator:OnDeInit()
I don't understand why that... In my understanding, the order of events diverges from what I understand to be correct.