Download MetaTrader 5
To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
Marcos Silva
305
Marcos Silva 2015.01.14 20:25 

Hi,

 

Im receiving the following error during pass 5++(more than 500) on my ea.  

 "Optimization stopped due to a fatal error in the EA"

 

Im thinking that one of the parameters from the optimization is forcing a zero divide on the program... 

 What else could it be?

 

 

Thanks 

Carl Schreiber
5934
Carl Schreiber 2015.01.14 21:10  
Can't tell you anything due to the information you gave us...
whroeder1
13596
whroeder1 2015.01.14 21:20  
investguy: Im thinking that one of the parameters from the optimization is forcing a zero divide on the program... 
Divide by zero is the reason. Parameters are irrelevant. What happens if Open==Close
Marcos Silva
305
Marcos Silva 2015.01.14 21:25  

I'll change my question... is there a way to know the CURRENT(before being displayed on the results) optimization pass settings??

 

Thanks 

Marcos Silva
305
Marcos Silva 2015.01.14 21:26  
WHRoeder:
Divide by zero is the reason. Parameters are irrelevant.

Due to the current parameter tested? Why it didnt give a error on the first pass ? 

thanks 

Marcos Silva
305
Marcos Silva 2015.01.14 23:19  

Hi,

 So far i have isolated the one setting that is giving me a hard time, in order to do that.

1) testing with open prices only i selected a weekly period of time at a time util i got to the day it give me the error

2) unselecting the variables to optimize i got to the ones that matter 

3) unselected the genetic optimization option.

 

With those settings in hand...

 

Testing the ea will NOT give me an Zero Divide Error. The ea just hangs.

Could it be a logical loop now??

Marcos Silva
305
Marcos Silva 2015.01.14 23:37  

Found the solution...

 

The optimization stopped due to the price being equal to opening price of a pending order... here is the solution:

if(BuyOnly)
           {
            if(Ask<ma) ticket=open(OP_BUYSTOP,ilots,ma,stoploss,takeprofit,expire,Blue);
            else if(Ask>ma) ticket=open(OP_BUYLIMIT,ilots,ma,stoploss,takeprofit,expire,Blue);
            else if(Ask==ma)ticket=open(OP_BUY,ilots,ma,stoploss,takeprofit,expire,Blue);
           }
         else
         if(SellOnly)
           {
            if(Bid>ma) ticket=open(OP_SELLSTOP,ilots,ma,stoploss,takeprofit,expire,Red);
            else if(Bid<ma) ticket=open(OP_SELLLIMIT,ilots,ma,stoploss,takeprofit,expire,Red);
            else if(Bid==ma) ticket=open(OP_SELL,ilots,ma,stoploss,takeprofit,expire,Red);
           }
         else
           {

 

 

Thank you all who helped! 

/
To add comments, please log in or register