JonathanPepperstone:
Hi community! I have coded this system and i keep having the error of zero divide in 'my code name'
could you please review my coding, what is the problem here?
Could be helpful if you specify which line produces the error.
I personally check the value of divisor before the divition operation . I do that almost always, unless I am sure that it is imposible that divisor be eual to zero.
As far as I can see, This is the only piece in your code that may result as zero :
double Slpips = MathAbs((entryprice - SL)/pipsCurrency());
You should make sure that entryprice and SL are not equal.
Because it is going to be the divisor in this line:
double positionsize = ((risk/tickvalue) / MathAbs(Slpips*pipsCurrency()) / (Lotsize)) ;
Also, you do not need to calculate the spread, you can just call SymbolInfoInteger using SYMBOL_SPREAD.
SymbolInfoInteger - Market Info - MQL4 Reference
- docs.mql4.com
SymbolInfoInteger - Market Info - MQL4 Reference
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi community! I have coded this system and i keep having the error of zero divide in 'my code name'
could you please review my coding, what is the problem here?