'Echo' in placing orders

To add comments, please log in or register
Bjorn Beerens
127
Bjorn Beerens  

I'm experiencing the problem of 'echo' when placing an order... I try to set one stop order but the EA always set a lot of orders...

Very weird. I assume it will be the fact that the ticks come very quick after each other and there needs to be some kind of delay after placing the first order, but I can't find it...

if (X > (Y + 0.5))
 {
   if (totalPendingBuys < 6)
   {
     gBuyTicket21 = OrderSend(_Symbol,OP_BUYSTOP,LotSize,Ask+2.5,MaxSlippage,Bid-StopLoss,Ask+100,"Buy order 21",MagicNumber,0,clrGreen);

   }
   
   if (totalOpenSells < MaxOrderDirection)
   {
     NewSellTicket = OrderSend(_Symbol,OP_SELLSTOP,LotSize,Bid-1,MaxSlippage,Ask+StopLoss,Bid-100,"New Sell Ticket 01",555,0,clrRed);
  
   }
   
   Y = X;
   Sleep(250);

 }

Anyone that can help me with a solution here?

Thx!

Mehrdad Jeddi
28564
Mehrdad Jeddi  

So "Sleep()" function doesnt work in backtesting based on MQL4 documentation,

And what are the X,Y variables and their values,

It may the if( X>(Y+0.5)) is always true,then it will send order immediately after calling each if condition.

Bjorn Beerens
127
Bjorn Beerens  
Mehrdad Jeddi:

So "Sleep()" function doesnt work in backtesting based on MQL4 documentation,

And what are the X,Y variables and their values,

It may the if( X>(Y+0.5)) is always true,then it will send order immediately after calling each if condition.


You mean sleep function cannot be used in backtesting? I didn't know this, thanks for the info.

X is the current average of the bid and ask ((bid+ask)/2

Y starts in init Y=X

Mehrdad Jeddi
28564
Mehrdad Jeddi  
Bjorn Beerens:


You mean sleep function cannot be used in backtesting? I didn't know this, thanks for the info.

Yes,it's based on MQL4 documentation if you have read it.

Bjorn Beerens:


X is the current average of the bid and ask ((bid+ask)/2

Y starts in init Y=X

So the code is incomplete,we dont know when the if condition will be true by which value.it should be defined,

So on which pair did you test?

So 0.5 for 3 digit pairs will be 50pips,for 5digit pairs will be 5000pips,we dont know the exact condition behind this incomplete code.

To add comments, please log in or register