EA Problem! OrderSend return succeed! but the OrderSymbol() not current Symbol() !In the same time send multiple order from difference currency windows.

[Deleted]  

Hi, all,

I met a problem for run EA on multiple currency.!

In the same time, EA send order to server in each currency windows! also each currency EA program will be check Order was created succeed!

but most time i check OrderSend status is succeed! but i used OrderSelect and OrderSymbol check the order Symbol, it is not current currency symbol,it is another currency symbol (by the way other currency windows also running this EA in the same time)

Seems it doesn't make sense . either it return error code to me, either return a correct ticket order to me. but this issue it return a incorrect symbol order. Does server can't identification each currency EA?

Also i have test run one account on two machine . seems it doesn't work, at same time only allow one machine(account) work!

so for my last conclusion :if i want to running multiple currency or the same time send multiple order i need use multiple account? it make sense?

Thanks

xinfang

gordon
2327
gordon  

Post your code or give more details. If you are receiving error #146 then read this -> https://www.mql5.com/en/articles/1412.


Generally there is no problem trading several currencies in the same account, with one or more EA's (in one or more Terminals), as long as these EA's have the capabilities to handle this situation.

[Deleted]  

here we are

int buyticket;

int sellticket ;

when CurTime() > xxx and CurTime < xxx

{

Call SendPending Function

}

bool SendPendingOrder()
{
   int buyerrcode=0;
   int sellerrcode=0;
   if(buyticket <=0 && IsTradeAllowed()){
      RefreshRates();
      double buyclose = Close[0];
      if (CurTime()-dend < 0){
         if (IsTradeAllowed()){
            buyticket = OrderSend(Symbol(),OP_BUYSTOP,Lots,(buyclose+Level*point),slippage,(buyclose+Level*point) -InitStopLoss*point,(buyclose+Level*point) +TakeProfit*point,"comment1" ,0,0,Green);
            buyerrcode = GetLastError();
            if (buyticket <=0)
            {
               Print(TimeToStr(CurTime(),TIME_SECONDS)," Order Buy failed! ErrorCode:" ,buyerrcode," Close:",buyclose," Stoploss:",InitStopLoss," Open:",(buyclose+Level*point)," Stop:",(buyclose+Level*point) -InitStopLoss*point," Profit:",(buyclose+Level*point) + TakeProfit*point);
            }
         }
      }
      
   }
   if(sellticket <=0 && IsTradeAllowed()){
      RefreshRates();
      double sellcose = Close[0];
      if (CurTime()-dend < 0){
         if (IsTradeAllowed()){
            sellticket = OrderSend(Symbol(),OP_SELLSTOP,SellLots,(sellcose-Level*point),slippage,(sellcose-Level*point) +InitStopLoss*point,(sellcose-Level*point) - TakeProfit*point,"comment1" ,0,0,Red);
            sellerrcode = GetLastError();
            if (sellticket <=0)
            {
               Print(TimeToStr(CurTime(),TIME_SECONDS)," Order Sell faild!ErrorCode:" ,sellerrcode," Close:",sellcose," Open:",(sellcose-Level*point)," Stop:",(sellcose-Level*point) +InitStopLoss*point," Profit:",(sellcose-Level*point) - TakeProfit*point);
            }
         }

      }
      
   }
   if (buyticket > 0 && !checkbuysymbol)
   {
      OrderSelect(buyticket, SELECT_BY_TICKET) ;
      if (OrderSymbol() != Symbol())
      {
         Print(TimeToStr(CurTime(),TIME_SECONDS),"TicketNumber:",buyticket," Order is not incorrect, try to more!");
         buyticket =0;  
      }
      else
      {
         checkbuysymbol = true;
      }
      

   }      // need to remove this order it not current currency order?
  
   if (sellticket > 0 && !checksellsymbol)
   {
      OrderSelect(sellticket, SELECT_BY_TICKET) ;
      if (OrderSymbol() != Symbol())
      {
         Print(TimeToStr(CurTime(),TIME_SECONDS),"TicketNumber:",sellticket," Order is not incorrect, try to more!");
         sellticket =0;  
      }
      else
      {
         checksellsymbol = true;
      }
      // need to remove this order it not current currency order?
   }
   if (!isOrderSend && buyticket > 0 && sellticket >0){
      Print(TimeToStr(CurTime(),TIME_SECONDS)," Order Finish,BuyTicket:",buyticket," SellTicket:",sellticket);
   }
   if (buyticket > 0 && sellticket > 0){
      isOrderSend = true;
   }
}
[Deleted]  

i met this problem again.,please help me look at the log.

for EA i have declare a buyticket and sellticket variable

such as

int buyticket = 0;
int sellticket = 0;

int init{
}
int start{
   run sendpendorder function
}

This EA runing on EURUSD and USDCAD currency

i didn't declare the buyticket is global variable, so run this EA on each currency is suppose not conflict. but why EURUSD currency get same ticket number with USD/CAD

i appreciate some guys can help me ?

buy the way most time it give me 130 error code. but i setup up the stoploss is 15 pips, looks 15 pips is very larger number, but sometimes it still return

130

Invalid stops.

=====================================================================

2010.10.09 09:15:51 EURUSDFXF,M1: Check Order Status. BuyTicket:0 SellTicket:0

2010.10.09 09:15:51 EURUSDFXF,M1: TicketNumber:13287855 Order is not incorrect, try to more!

2010.10.09 09:15:51 EURUSDFXF,M1: open #13287855 sell stop (instead of buy stop) 0.30 USDCADFXF at 1.0198 sl: 1.0213 tp: 1.0158 ok

2010.10.04 09:14:50 USDCADFXF,M1: Alert: Order not successfully,please check,,,,

2010.10.04 09:14:49 USDCADFXF,M1: Check Order Status. BuyTicket:-1 SellTicket:13287855

2010.10.04 09:14:49 USDCADFXF,M1: Alert: Order not successfully,please check,,,,

2010.10.04 09:14:49 USDCADFXF,M1: open #13287855 sell stop 0.30 USDCADFXF at 1.0198 sl: 1.0213 tp: 1.0158 ok

2010.10.04 09:14:46 USDCADFXF,M1: Order Buy failed! ErrorCode:130 Close:1.021 Open:1.0222 Stop:1.0207 Profit:1.0262

.. USDCAD and EURUSD send buy and sell ticket at same time..

========================================================================================================

[Deleted]  

any advice?

Thanks

[Deleted]  
up!!