Problem solved

 

Problem solved

There is no error in the code.

   && LastHistoryDirection() >= 0 //Last Historical Trade Direction >= fixed value
   )
     {
      RefreshRates();
      price = Bid;
      SL = 40.0 * myPoint; //Stop Loss = value in points (relative to price)  
      if(IsTradeAllowed())
        {
         ticket = myOrderSend(OP_SELLLIMIT, price + 50.0 * myPoint, TradeSize, "");
         if(ticket <= 0) return;
        }
      else //not autotrading => only send alert
         myAlert("order", "");
      myOrderModifyRel(ticket, SL, 0);
     }
  }

Thank you

 
Robson Fernandes: How do i get him to execute only one order?
  1. You don't want only one order — you want one order per symbol.
  2. Count your open orders with an OrderSelect loop and don't open a second one.
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
              MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
 
Robson Fernandes:

How do i get him to execute only one order?

Thank you

If you mean only one open position in the same time then this is how to do it.
   && LastHistoryDirection() >= 0 //Last Historical Trade Direction >= fixed value
   )
     {
      RefreshRates();
      price = Bid;
      SL = 40.0 * myPoint; //Stop Loss = value in points (relative to price)  
      int total_positions=PositionsTotal();//get total open positions number
        if(IsTradeAllowed()&&total_positions==0)//check if there is no open positions
        {
         ticket = myOrderSend(OP_SELLLIMIT, price + 50.0 * myPoint, TradeSize, "");
         if(ticket <= 0) return;
        }
      else //not autotrading => only send alert
         myAlert("order", "");
      myOrderModifyRel(ticket, SL, 0);
     }
  }