Obviously bug in indicators OnInit() return value effect - page 2

 
Dominik Egert #:

As responded by MQ on russian forum, it is a feature, not a bug. Please see post here:

https://www.mql5.com/ru/forum/1111/page3465#comment_51950020


But here is a method for making an indicator permanent, unremovable by any means, except for restarting the entire terminal.


I am not sure, if this is meant to be that way, I guess not.

Supposedly, it is also not desired to retrieve a handle on the same instance of the indicator. - Questionable.

For now, this is the only generic way to gain access to custom defined buffers within the same indicator. - That actually works.

So in conclusion, it is possible to receive a handle to your own instance of indicator, retrieve its buffer values in a generic way, but you cannot remove the indicator anymore, after retrieving the handle.

https://www.mql5.com/ru/forum/1111/page3472#comment_51964852

 

While also wondering about this behavior, I stumbled upon this thread.

This is how I solved it:

if (failingCondition) {
  ChartIndicatorDelete(0, ChartWindowFind(), MQLInfoString(MQL_PROGRAM_NAME));
  return(INIT_FAILED);
}

Maybe it helps someone.

Still, I cannot believe that this an actual feature.

 
Eric Emmrich #:

While also wondering about this behavior, I stumbled upon this thread.

This is how I solved it:

Maybe it helps someone.

Still, I cannot believe that this an actual feature.

I don't know if it's bug or in a feature in MQ developers mind at the origin (MT4 is by no way a valid reference about what is a bug or not), but it has always being like that and it can't be changed without breaking all existing indicators.

My opinion is it's a real feature, I really don't want the indicator to be removed from the chart each time there is a small issue in OnInit().

Having a new option INIT_CRASH or something could be useful from time to time though.