A strange problem - function remains in a cycle or freezes

 

Friends, this looks very strange to me. This function works:

if (MathAbs(total_profit) < 1.0){
      line_name = "ZERO LEVEL ex SWAP";
      line_color = Black; draw line etc...

 When I change it and add division by a double number, the function remains in a cycle or freezes, it simply stops working:

 

if (MathAbs(total_profit / current_tick_value) < 1.0){
      line_name = "ZERO LEVEL ex SWAP";
      line_color = Black;
... now a line should be drawn but it never works!

Would anybody have an idea what is wrong? 

 

Thank you! Pavel 

 
solator:

Friends, this looks very strange to me. This function works:

 When I change it and add division by a double number, the function remains in a cycle or freezes, it simply stops working:

Not sure what function you are talking about . . but anyway.

You didn't just add the division,  you also added { } braces,  well I see one so I assume there is another . . . that fundamentally changes the way your code works.

 
RaptorUK:

Not sure what function you are talking about . . but anyway.

You didn't just add the division,  you also added { } braces,  well I see one so I assume there is another . . . that fundamentally changes the way your code works.


Hello, RaptorUK, that was a typo, I have not added braces or changed anything else, just really added the division. Also, the current_tick_value is not zero. I just cannot find out why the function from which is this piece of code stopped working.

Thanks! Pavel 

 

solator:

When I change it and add division by a double number, the function remains in a cycle or freezes, it simply stops working:

Would anybody have an idea what is wrong? 
There are no mind readers here. Add Print() before the IF, inside the IF, at the exit of the IF, and find out where.
 
WHRoeder:
There are no mind readers here. Add Print() before the IF, inside the IF, at the exit of the IF, and find out where.


Hello, I found the problem finally. I wanted to do what you recommended but it was difficult because Print() or Comment() did not work at all! I was wrong when I said the denominator was not zero. It was... Now it works fine. Conclusion: division by zero made the program freeze or cycle in a loop or maybe jump to some undefined address...

Thank you all, Pavel. 

 
solator:


Hello, I found the problem finally. I wanted to do what you recommended but it was difficult because Print() or Comment() did not work at all! I was wrong when I said the denominator was not zero. It was... Now it works fine. Conclusion: division by zero made the program freeze or cycle in a loop or maybe jump to some undefined address...

Thank you all, Pavel. 

You will usually get a entry in the journal/experts tab if you have a divide by zero.
 
RaptorUK:
You will usually get a entry in the journal/experts tab if you have a divide by zero.


OK, perfect, that I did not know. That would help! Next time I will check it! Thank you! Pavel