How to Fix Critical Runtime Error 503 in Ontick Function
-
Hello fxDreema! All right? Hope so.
I'm having this problem again:
2017.05.18 10: 48: 30,097 MQL5 Cloud USA Genetic pass (0, 287) tested with error "Runtime Critical Error 503 in OnTick Function (Zero Division, Module Experts \ Advisors \ X Standard v8.1 P.ex5, File X Standard V8.1 P.mq5, line 14358, col 69) "at 0: 16: 00.329 (PR 139)I checked in other post that the problem is in the indicator. I created the ATR for the fxDreema together with you, but it's not perfect.
See the project here: shared/8KUuCxldc
I would like to fix it so that it can work perfectly in the tests, and if possible I need a fix to be identical to the ATR of the MT5 platform.
-
is not that caused when ATR_Multiplo is 0? because here is zero divide
... when you need divide with 0 or something very close to 0, place somewhere before this divide code this:
if(ATR_Multiplo==0) { ATR_Multiplo=0.000001; }
and it prevent your code from null divide error and you will be able to divide with number very close to null ... -
Hello Miro1360
I do not use in the ATR_Multiple parameter 0, but optimize from 1, of type int.
The problem is specifically mentioned in this line of code:else if (mode=="balanceRisk"){size=((value/100)*AccountBalance())/(sl*TickValue*PipValue(symbol));} -
you can be sure, that it is caused by divide, so do something easy to avoid it:
your code:
else if (mode=="balanceRisk"){size=((value/100)*AccountBalance())/(sl*TickValue*PipValue(symbol));}change to this:
else if (mode=="balanceRisk"){ if(sl==0){size=0;} else if(TickValue==0){size=0;} else if(PipValue(symbol)==0){size=0;} else {size=((value/100)*AccountBalance())/(sl*TickValue*PipValue(symbol));} } -
Thanks for the info. I'll be trying to do that.
So ... would not it also be interesting to have this fixed also in the mql5 codes generated by fxDreema?
-
I am not sure if this solved your problem ... and about fix in fxdreema, maybe it can help in some situations where TickValue or PipValue() returns 0 ...
-
Well, it's strange if PipValue() returns 0. What symbol are you using now, tcanuto?

-
I had situation when USDCHF returned me 0 in that case
so only solution was hardly code data, not from symbolinfo ... -
@fxDreema Hello!
I'm having this problem with the 'WDO @ N' symbol (which is the Dollar / Real), but I've had this same problem with other symbols.
-
@miro1360 It worked! Thanks for the info.
Maybe you could help me in this post: https://fxdreema.com/forum/topic/3036/How-to-use-2-volume-modes/3?page=1#none
-
@miro1360 I'm having a similar problem: My "zero divide" error appears because the MarketInfo (symbol, MODE_POINT) is returning 0. Here's the piece of code that is presenting error:
double PipValue(string symbol="")
{
if (symbol=="") {symbol=GetSymbol();}
return(CustomPoint(symbol)/MarketInfo(symbol,MODE_POINT)); <---- This is the division where the error occurs.
/*
if (symbol=="") {symbol=GetSymbol();}
int digits=MarketInfo(symbol,MODE_DIGITS);
if ((digits==2 || digits==4)) {return(POINT_FORMAT/0.0001);}
if ((digits==3 || digits==5)) {return(POINT_FORMAT/0.00001);}
if ((digits==6)) {return(POINT_FORMAT/0.000001);}
return(1);
*/
}I'm using it for trade the DAX index. Any tip about how to make the EA work with DAX and another CFD's?
-
I have same issue in double PipValue function when I use the block
No pending order exists -
I found the bug for me:
I was looping through the allowed Symbols in my EA and when i have a non existing Symbol I get this strange error at a place where I wouldn't expect it.
Some Alerts in the MT4 source Code are always helpful for debugging.

-
This function PipValue() is so old and I'm so afraid to change anything in it, so that some old commented text can be seen in it

But the function itself works and this "zero divide" thing is correct. I mean, it is a fatal error, but this error basically says that there is some problem with the symbol that should be somehow fixed. Why do you use non existing symbol?
-
But the function itself works and this "zero divide" thing is correct. I mean, it is a fatal error, but this error basically says that there is some problem with the symbol that s
I had an understanding problem in custom blocks.
Setting variables in the Variables List on white button (on Block entry) and then using this variable as input tricked me, because the input is taken before the variable is set by white button. Hopefully this is understandable. Now I set CurrentSymbol in the pass block and it works