I don't know why sometimes my indicator freeze !

 

Hi my friends!

 I just developed an indicator which is based on my own idea, but I have a difficulty with it. Sometimes when I change my "input variables" it doesn't do anything nor does it give any error and it needs to change my timeframe in the chart ( for example from D1 to H4) to be executed and when I do so it gives me the proper result that I want and when I change my timeframe again to D1 it still provides me the correct result.

I'd appreciate if anyone help me know what the problem is ? and why it oblige me to change the timeframe to execute correctly?

Thanking in advance,

have a great time 

 
Do you perform some (pre) calculation in OnInit() function?
 
Rasoul:
Do you perform some (pre) calculation in OnInit() function?

Yes , I do so.

I can say most of my calculations are performed in OnInit().

I have written the exactly same code for MQL4 but I did't face with such problem.

It takes a bit more time to execute in charts but in MQL4 it is executed in a glance.

 
parham.trader:

Yes , I do so.

I can say most of my calculations are performed in OnInit().

I have written the exactly same code for MQL4 but I did't face with such problem.

It takes a bit more time to execute in charts but in MQL4 it is executed in a glance.

You have some bugs in your code, not possible to help without seeing this code.
Reason: