Weird 'zero divide' error
-
Until yestarday, my backteting was working fine but for some reason I don't understand, today I cannot continue because I get this zero divide error:

And here you can see both lines 31 and 9193 of the code:


I found some possible reasons in other threads, but none of them apply to my EA:
- All trades have a fixed pips SL selected with a double constant.
- Bactesting is executed with USD as main currency.
- I'm not using custom indicators.
- I'm backtesting this symbol for weeks with no problem so far. It is the Dow Jones Index.
The only modifications I added to the EA are a standard trailing stop block (not activated due to the backtesting beong blocked before? and a MA crossing boolean variable.
These are both buy and sell now blocks:

All variables are of a double type and they worked fine until yesterday.

-
@l-andorrà hello! I cannot solve your problem, but i can say that the error is at #9193 row and #31 column, near the / sign

-
@ambrogio Ok. Thank you. I didn't know the second number was the column. I hope someone will be able to tell me what's the issue.
-
Hmm I'm not a programmer either but I found the function documentation https://www.mql5.com/en/docs/marketinformation/symbolinfodouble
the line seems to be correct..
If the error is "0 devide" , and you say you are testing it on Down Jones, it could be that the second part of the fraction which takes the value of the symbol is equal to 0 because the market is closed..
It is just a suggestion. -
So dow jones doesnt work, does forex symbols work?
A hacky way to fix the code could be replacing "symbol" with "Symbol()" in the line you boxed in red. I don't know if its going to mess up something, though. Its about the pip values and formatting, I never touch those.
-
@l-andorrà I counted the columns well, it looks like column 31 is right the " / " , have you setup the pips size rules for DJ ?
-
@roar It works correctly for all symbols in my broker. It worked fine until yesterday!!!

I did as you suggested and now backtesting is working again, but I will do more in order to check no more issues arised dute to this change.
Also thank you to seb0 and ambrogio for your help.