ordersend error trade timeout

 

Is there any way I can prevent this from happening or to send the order again if it fails?

My EA can place multiple trades and I am not sure if this is causing the issue, the fact I have 10+ terminals running or just poor EA coding on my part.

The EA seems to run into this problem when trying to modify the order (stop loss + take profit):

void SellTrade()
    {

    double SL = Bid + StopLoss*PipValue*Point;
    if (StopLoss == 0) SL = 0;
    double TP = Bid - TakeProfit*PipValue*Point;
    if (TakeProfit == 0) TP = 0;
    int ticket = -1;
    if (true)
    ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, MaxSlippage, 0, 0, ExpertName, MagicNumber, 0, Red);
    else
    ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, MaxSlippage, SL, TP, ExpertName, MagicNumber, 0, Red);
    if (ticket > -1)
    {
        if (true)
        {
            OrderSelect(ticket, SELECT_BY_TICKET);
            bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
            if (ret == false)
            Print("OrderModify() error - ", ErrorDescription(GetLastError()));
        }
            
    }
    else
    {
        Print("OrderSend() error - ", ErrorDescription(GetLastError()));
    }

}
 
gangsta1: Is there any way I can prevent this from happening or to send the order again if it fails?
  1. Create a 99.99999% perfect Internet and give your broker a 99.99999% server.
  2. The documents say wait a minute (after connection is reestablished,) look at open order list and find out if the trade has opened or you need to retry.
Reason: