Download MetaTrader 5

OrderSend() error 129

To add comments, please log in or register
DeanDeV
330
DeanDeV  

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
15724
whroeder1  
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  
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