Zero Divide error on terminal start up if indicator is left running - page 2

 
user3822:

I don't think that's the case and, for the sake of anyone wishing to understand more, I'll explain why:

‌As pointed out by whoroeder1, when you launch MT4, the data from MarketInfo(Symbol(),MODE_TICKVALUE) isn't available until after certain processes have taken place. Therefore, it will be a 0 until those processes take place. This is can be proven by creating and initializing a global variable with MarketInfo(Symbol(),MODE_TICKVALUE), then using the print(DoubleToString(variable,number)) function in OnInit and OnCalculate.

If it were something wrong with the code, it would be reproducible outside of the launching the program at startup. Outside of this one instance, the indicator works perfectly fine and even fixes itself once I switch the timeframe on the chart that it's loaded.

Lastly, as I described in my last post, it's easily fixed by an if statement that waits for the variable 'tickValue' to be greater than 0.

That is obvious that the indicator must be able to account for when not yet being connected or when a connection goes down mid-way, but in a stable environment, you should not be getting those problems!‌

Reason: