my EA isn't called on each transaction

 
void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
      string url;
      string time=TimeToString(TimeCurrent());
      string cookie=NULL,headers;
      char post[],results[];
      int res;
      int timeout=5000;
      if(OrderSelect(trans.order)){
         double closeprice = OrderGetDouble(ORDER_PRICE_CURRENT);
         url= "http://www.url.com/test.php?id="+(string)trans.order+"&asset="+trans.symbol+"&type="+EnumToString(trans.order_type)+"&opentime="+time+"&price="+StringFormat("%G",trans.price)+"&stopprice="+StringFormat("%G",trans.price_sl)+"&limitprice="+StringFormat("%G",trans.price_tp)+"&closeprice="+StringFormat("%G",closeprice)+"";
         res=WebRequest("GET",url,cookie,NULL,timeout,post,0,results,headers);
         if(!res)
            GetLastError();
         else Alert("success");
      }
      if(PositionSelectByTicket(trans.position)){
         url= "http://www.url.com/edit_position.php?asset="+trans.symbol+"&stopprice="+StringFormat("%G",trans.price_sl)+"&limitprice="+StringFormat("%G",trans.price_tp)+"";
         res=WebRequest("GET",url,cookie,NULL,timeout,post,0,results,headers);
         if(!res)
            GetLastError();
      }
  }

Hello everyone, I'm developing a PHP platform for signals that communicates with trader's MT5 client. Every transaction should make a httprequest via EA and send data to my MySQL database. I tested it on my computer and it worked. I was experiencing some issues when tried to open many transactions at the same time, because the EA wasn't called on all of them. The main issue is that I moved the code to my trader's client and most of the time the EA isn't called when a transaction occured. IMO, the code works properly when called, but why isn't it called on each trade?

 
k1zz100:

Hello everyone, I'm developing a PHP platform for signals that communicates with trader's MT5 client. Every transaction should make a httprequest via EA and send data to my MySQL database. I tested it on my computer and it worked. I was experiencing some issues when tried to open many transactions at the same time, because the EA wasn't called on all of them. The main issue is that I moved the code to my trader's client and most of the time the EA isn't called when a transaction occured. IMO, the code works properly when called, but why isn't it called on each trade?

1° You are calling Webrequest(), it's a synchronous function, it takes time to return, meanwhile you can (you will) miss event(s).

Transactions queue length comprises 1024 elements. If OnTradeTransaction handles a new transaction for too long, the old ones in the queue may be superseded by the newer ones.

2° There is no guarantee to receive a OnTradeTransaction event for each server events.

One trade request manually sent from the terminal or via OrderSend()/OrderSendAsync() functions can generate several consecutive transactions on the trade server. Priority of these transactions' arrival at the terminal is not guaranteed. Thus, you should not expect that one group of transactions will arrive after another one when developing your trading algorithm. Besides, transactions can be lost during delivery from the server to the terminal.

Reason: