Help - Zero Divide
I only have those divisions in the EA:
double STOP_HIGH = NormalizeDouble((iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,DIST_EXT,0))-Bid) / (Point*10),Digits);
double STOP_LOW = NormalizeDouble((Ask - iLow(NULL,0,iLowest(NULL,0,MODE_LOW,DIST_EXT,0))) / (Point*10),Digits);
double LotsDN = NormalizeDouble((AccountBalance()*Risk_percent/100) / ((STOP_HIGH)*tickvalue),1);
double LotsUP = NormalizeDouble((AccountBalance()*Risk_percent/100) / ((STOP_LOW)*tickvalue),1);
I've tried to understand what is wrong but can't see no mistakes in that!!! :(:(:(
Example:
if( STOP_HIGH !=0 && tickvalue !=0 ){
double LotsDN = NormalizeDouble((AccountBalance()*Risk_percent/100) /
((STOP_HIGH)*tickvalue),1);
}
Since you already know all the divisions within the EA. Then Line Comment the OTHERS //--. Or /* ---- */.
And fix them One by One. And test em in Back-tester til you no longer see 0-Divide.
I will do that... than post here the results :)
Thanks ubzen
.
I've made what you've told me..
I found that the EA is given sometimes the ZeroDivision (not always... just a few separated times) because of the
/ (STOP_HIGH)*tickvalue
division. But I can't understand why!!!
I'll continue to break my head on this rock...
.
FOUND THE PROBLEM!!! :) :) :)
Sometimes the:
(iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,DIST_EXT,0))-Bid)
That is part of STOP_HIGH can be zero!!!
LOL.. Tester is always right!!
Thank you very much ubzen!! : )
Hi,
I'm triyng to write my first EA and I've already got the first part of it (entry points).
Unfortunately it gives me various Zero Divide errors in Journal.. :(
I'm around this error for days and getting crazy!!! :(
Can someone please take a look?