I'm returning INIT_FAILED in a indicator OnInit function, but it's created anyway.
If a EA tries to load it it get a valid handle and can't identify that's not working properly.
I also tried to force an error, but it get loaded anyway.
Anything wrong with my approach?
use:
#property strict
than after INIT_FAILED script/indicator/EA will be stopped and removed from chart.
use:
than after INIT_FAILED script/indicator/EA will be stopped and removed from chart.
I'm returning INIT_FAILED in a indicator OnInit function, but it's created anyway.
If a EA tries to load it it get a valid handle and can't identify that's not working properly.
I also tried to force an error, but it get loaded anyway.
Anything wrong with my approach?
In my opinion it's a bug (at least when used with iCustom) and I reported it to ServiceDesk more than 3 years ago. I never got an answer so I closed the ticket.
Try to add code to remove the indicator from the chart in OnDeinit() :
//+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { if(reason==REASON_INITFAILED) { int window=ChartWindowFind(ChartID(),"shortname"); ChartIndicatorDelete(ChartID(),window,"shortname"); } }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm returning INIT_FAILED in a indicator OnInit function, but it's created anyway.
If a EA tries to load it it get a valid handle and can't identify that's not working properly.
I also tried to force an error, but it get loaded anyway.
Anything wrong with my approach?