Download MetaTrader 5

ZeroDivide error

To add comments, please log in or register
No time to learn MQL5? Order your application from a developer!
Da Silva Andre Luiz
134
Da Silva Andre Luiz 2015.06.15 15:15 

I know... has too much here but i can't find something that I looking for... if someone could help me....

I have a EA that will send Order to the market calculating SL size getting price base on HLINE using a Risk % extern bouble....

but i'm have problem....

sometimes SL its too big exceding risk % profile.... the this error "Zero Divide by" appears and EA shuts down, i don't like open lots more than my Risk % how do will can fix it? Some tips? 

Gordon Gekko
622
Gordon Gekko 2015.06.15 18:28  
andreforex:

I know... has too much here but i can't find something that I looking for... if someone could help me....

I have a EA that will send Order to the market calculating SL size getting price base on HLINE using a Risk % extern bouble....

but i'm have problem....

sometimes SL its too big exceding risk % profile.... the this error "Zero Divide by" appears and EA shuts down, i don't like open lots more than my Risk % how do will can fix it? Some tips? 

if(divisor!=0.0)

{

// original code with division

}

else

{

// what to do if divisor = 0

}
To add comments, please log in or register