what can cause my variable value to get stucked to a fixed number?

 

Hi all,

i am using ontick() and i have a calculation to loop all the orders profit for every tick change

it is running fine all the time but some time the value got stuck to a fixed last calculated value

 only by reloading the ea, i will get the value to keep updating again

 

any idea what might cause this? 

edit : for this time i noticed it happened on usdcad only on all 3 different terminals that has the usdcad chart. strange 

 
A bug in your code.
 
Alain Verleyen:
A bug in your code.

 

any idea what kind of bug can caused the caculation to stop or hang?

 because it is normally running perfectly like 99% of the time, just some time it hang 

 
alain means you should post your code :D
 
Top-SecreT:
alain means you should post your code :D

i don't think it is my code because it seems the entire ea just stopped working

 maybe mt4 just freezed. i heard of this kind of issue b4 if u open too many terminal at once 

 
Are you using a While loop , or calling the OnTimer function ?
 
Lorentzos Roussos:
Are you using a While loop , or calling the OnTimer function ?

no

 

only a few for loop 

 
Are you accessing the open trades only?
 
Lorentzos Roussos:
Are you accessing the open trades only?

yes i am looping to find the current profit / loss of open trades with OrderProfit()

 

edit : for this time i noticed it happened on usdcad only on all 3 different terminals that has the usdcad chart. strange  

 
anyone?
 
bobo1974:
anyone?
the bug is in your code