Download MetaTrader 5
To add comments, please log in or register
Do you need a trading robot? Orderit via Freelance service!
Tjipke de Vries
6277
Tjipke de Vries 2014.03.11 12:01 

This is what i saw

EA on chart

Closed its trades and had to restart new trades

but error from EA '2014.03.11 11:12:28.713 zero divide in 'robodo4.8.mq4' (713,56)' (Build 600)

the moment EA was attached to chart

double Lot = 0.2;
double MinLot,LotStep,StopLevel;


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---- 
   MinLot = MarketInfo(Symbol(), MODE_MINLOT);
   LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);
   MaxLot = MarketInfo(Symbol(), MODE_MAXLOT); 
   Stoplevel = MarketInfo(Symbol(), MODE_STOPLEVEL);
   if(Lot < MinLot)Lot = MinLot;

   return(0);
  }

function at line 713

//+------------------------------------------------------------------+ 
//--- Function test of the correctness and rounding --- 15 ---//
double LotRound(double L) {
 return( MathRound(MathMin(MathMax(L, MinLot), MaxLot)/LotStep)*LotStep ); }
//+------------------------------------------------------------------+

my question do i need to replace all int init() in newbuild for int OnInit()

avoiding this happens ??

Alain Verleyen
Moderator
28552
Alain Verleyen 2014.03.11 14:18  
deVries:

This is what i saw

EA on chart

Closed its trades and had to restart new trades

but error from EA '2014.03.11 11:12:28.713 zero divide in 'robodo4.8.mq4' (713,56)' (Build 600)

the moment EA was attached to chart

function at line 713

my question do i need to replace all int init() in newbuild for int OnInit()

avoiding this happens ??

Actually not.

Is this problem arises also with build 610 or 616 ?

Tjipke de Vries
6277
Tjipke de Vries 2014.03.11 14:27  
angevoyageur:

Actually not.

Is this problem arises also with build 610 or 616 ?




can't tell the testingdemo's i'm using are 3 times 600 1 time 604

and it takes time to see it happen because it has to appear at live trading

i am using it to find bugs i can't find testing EA's on StrategyTester

Bambang Sugianto
9831
Bambang Sugianto 2014.03.12 11:52  

since build 600 sometimes init not executed well

so from now i always add some code.. if init failed.. init again

int dg=0;
double pt;
void  init()
  {      pt=Point; dg=1;
  if (Digits==3||Digits==5){pt=10*Point;dg=10;}
  }
//+------------------------------------------------------ 

int start()
  { if (dg==0){init();return(0);}


  }
//---- 
Tjipke de Vries
6277
Tjipke de Vries 2014.03.12 16:25  
WDholic:

since build 600 sometimes init not executed well

so from now i always add some code.. if init failed.. init again


Thanks, so i'm not the only one noticed there was something strange on init()

nice solution to workaround this error.

Ian Venner
2583
Ian Venner 2014.03.12 18:14  

I havent noticed anything like that with indicators. I've been working mostly with indicators since build 600 due to a project I'm working on, if init() was not executed indicators would fail due to lack of buffers.

/
To add comments, please log in or register