what make the error zero devide to occour?

 
i've got this error and tried backtest in visual mode many times but still can not find out why this error occour

pls someone know any reason to force this happen pls reply ^_^
 
check divider before each division operation
 
it can be very simple and it can be real pain to find this problem. Zero divide means often luck of data. For example, using an array could cause it, as array doesn't have any values. Even if it does have a value, maybe you have less data than you are looking. Array with size of 1000 gives you array[1001]=nothing (zero).
Second possibility is a small mathematical problem, where at some condition you get utopia in a term of math... like sqrt(-1) or x/high-low... where high=low.. . playing with prices gives you very often that kind of error because going through data tick by tick it is possible that your math has at some point this condition. if you have something like x/y in your code (in whatever form) try using condition if y==0 alert++condition like where the code is and what are the variable at the moment and then try to figure it out, how to overcome that kind of situation.

good luck!
zolero
 
zolero:
it can be very simple and it can be real pain to find this problem. Zero divide means often luck of data. For example, using an array could cause it, as array doesn't have any values. Even if it does have a value, maybe you have less data than you are looking. Array with size of 1000 gives you array[1001]=nothing (zero).
Second possibility is a small mathematical problem, where at some condition you get utopia in a term of math... like sqrt(-1) or x/high-low... where high=low.. . playing with prices gives you very often that kind of error because going through data tick by tick it is possible that your math has at some point this condition. if you have something like x/y in your code (in whatever form) try using condition if y==0 alert++condition like where the code is and what are the variable at the moment and then try to figure it out, how to overcome that kind of situation.

good luck!
zolero
thanks for good explaination ^_^
Reason: