Download MetaTrader 5
To add comments, please log in or register
One billion tasks have already been executed with MQL5 Cloud Network. Test trading robots even faster!
DeanDeV
330
DeanDeV 2015.06.10 09:30 

Hey guys,

 I send 2 orders at the exact same time, yet one returns this error and the other gets placed just fine. Any reason why this would happen?

int buyMA=OrderSend(Symbol(),OP_BUY,Lotsize,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),"Buy order",MagicNumber,0,clrBlue);
  if(buyMA>0) Print("Buy order placed successfully.");
  if(buyMA<0) Print("Buy order failed to place, error#",GetLastError());

int buyMAntp=OrderSend(Symbol(),OP_BUY,Lotsize,Ask,3,Ask-(StopLoss*Point),0,"Buy order",MagicNumber,0,clrBlue);
  if(buyMAntp>0) Print("Buy order placed successfully.");
  if(buyMAntp<0) Print("Buy order failed to place, error#",GetLastError());

 The second order fails. It has done this 2 days in a row now?

 Please help.  

whroeder1
14212
whroeder1 2015.06.10 14:11  
It takes time to open an order (up to minutes). By the time you try to send the second one Ask may be very much out of date. You must RefreshRates() between server calls.
DeanDeV
330
DeanDeV 2015.06.10 14:17  
WHRoeder:
It takes time to open an order (up to minutes). By the time you try to send the second one Ask may be very much out of date. You must RefreshRates() between server calls.
Okay, thank you.
/
To add comments, please log in or register