Discussion of article "Trade Events in MetaTrader 5" - page 3

 

Renat:
Конечно после принятия сервером - это же очевидно. Кроме того, функция называется OrderSEND.

OK, I see!

As for "obviousness" - this is mostly for those who have been working closely with the system for more than a year. I stumbled on the question of whether the phrase from the reference book (for the OrderSend() function "in case of a successful basic check of structures, true is returned") can be considered as a sufficient condition for returning true. Now it turns out that no, it cannot: it is only a necessary condition, but not a sufficient one.

 
Interesting:
In my opinion, you should not draw conclusions only from true, you should analyse the server response code as well (and the last one is of higher priority, as it seems to me)...

Yes, these few hours have made me feel as if a veil has fallen: there is no code for "successful check of the base structure" (let's call it so) among return codes at all, and that's why true cannot be returned immediately after the base check.

As for detailed analysis of the return code - yes, it is recommended in the reference book. I just keep looking for ways to reasonably reduce the number of available checks.

 

Can you please explain what it means. The warrant has been placed in the queue ?

The following situation

2011.01.26 12:59:26 Network '716201': connection to MetaQuotes-Demo lost
2011.01.26 12:59:26 Trades '716201' : failed instant buy 1.00 EURUSD at 1.37136 [No connection]
2011.01.26 12:58:40 Trades '716201' : instant buy 1.00 EURUSD at 1.37136
2011.01.26 12:56:17 Network '716201': terminal synchronised with MetaQuotes Software Corp.

manual trading. I press Buy on the market without stops and TP. A message is displayed, the order is queued...connection breaks...is restored...the order is not executed.

What is this queue? Where is it located? If the order is already accepted by the server, why is it not executed? Reason?

 
Links are for the russian site!
 
Nice article indeed.
 
void CheckStartDateInTradeHistory()
  {
//--- initial interval, as if we started working right now
   datetime curr_start=TimeCurrent()-days*PeriodSeconds(PERIOD_D1);
//--- make sure that the start limit of the trade history has not gone 
//--- more than 1 day over intended date
   if(curr_start-start>PeriodSeconds(PERIOD_D1))
     {
      //--- we should correct the start date of history to be loaded in the cache 
      start=curr_start;
      PrintFormat("New start limit of the trade history to be loaded: start => %s",
                  TimeToString(start));

      //--- now load the trade history for the corrected period again
      HistorySelect(start,end);

      //--- correct the number of deals and orders in the history for further comparison
      history_orders=HistoryOrdersTotal();
      deals=HistoryOrdersTotal();
     }
  }

see the last two lines?

should they be:

history_orders=HistoryOrdersTotal();  // okay, looks correct

deals=HistoryDealsTotal();  //a typing error, perhaps? 

 

The article tells about asynchronous trading events, when the receipt of an order ticket when sending a request with the OrderSend() function and the appearance of the order in the terminal may not coincide in time. Everything is clear here. Last autumn people advised to overcome such asynchrony by falling asleep for three seconds. But what is the guaranteed time for which both the ticket value and the order itself will appear in the terminal (after the server accepts the order)? I can wait for 20 seconds, if necessary, but I would like to know what period of time is guaranteed to ensure such "manual synchronisation".

 

Thanks a lot. This really helped me solve some confusions.

 Regards,

Umer Aziz