Why when I lunch Metatrader, this Indicator becomes BROKEN?

 

I really don't understand MT5...

I'm using a custom indicator that works perfectly when loaded on a chart. Zero lag, fast, no issues. I can modify every parameter, remove it and reload it on other  20 other charts, and it still works perfectly.

You know when it doesn't work? When I close MT5 and then reopen it.... I don't know what is happening, but apparently when you lunch MT5 the indicator doesn't load like it normally would, and it become sooo slow that the entire terminal freezes.

I tried all morning to understand what the hell is going on.... pls tell me what it could be.... thanks

 
dario1133: I really don't understand MT5... I'm using a custom indicator that works perfectly when loaded on a chart. Zero lag, fast, no issues. I can modify every parameter, remove it and reload it on other  20 other charts, and it still works perfectly. You know when it doesn't work? When I close MT5 and then reopen it.... I don't know what is happening, but apparently when you lunch MT5 the indicator doesn't load like it normally would, and it become sooo slow that the entire terminal freezes. I tried all morning to understand what the hell is going on.... pls tell me what it could be.... thanks
Then that means that there is a bug in the custom indicator. Just as you stated, the indicator is "broken" and needs to be fixed.
 
Most likely it is trying to access data which is not(yet) available.
 
Enrique Dangeroux #: Most likely it is trying to access data which is not(yet) available.

I agree! It's probably trying to do stuff in the OnInit() event handler instead of only doing it in the OnCalculate() event handler only after the rates_total variable has a valid value.

 
Enrique Dangeroux #:
Most likely it is trying to access data which is not(yet) available.

You were right!!!

it was iBarShift() inside onCalculate() that was causing the problem... apparently MT5 doesn't load fast enough and this lead  to disaster. WOW.

Thank you so much for your hint

Reason: