FORTS. Fragen der Durchsetzung - Seite 86

 
fxsaber:
Ich habe meinen Koffer nicht dabei. Es gibt Terminalprotokolle, die für alle Benutzer gleich sind.

OK, die Protokolle sind die gleichen, aber leider sind die Ergebnisse unterschiedlich...

Sie übersehen hartnäckig den Unterschied zwischen 289 und 9 ms.

Hier ist eine neue (echte 1531).

2017.02.17 14:05:01.032 Trades  'xxxxx': buy limit 2.00 Eu-9.17 at 65030
2017.02.17 14:05:01.437 Trades  'xxxxx': accepted buy limit 2.00 Eu-9.17 at 65030
2017.02.17 14:05:01.444 Trades  'xxxxx': buy limit 2.00 Eu-9.17 at 65030 placed for execution in 412.406 ms (179.952 ms on server)
2017.02.17 14:05:01.449 Trades  'xxxxx': sell limit 1.00 BR-8.17 at 57.45
2017.02.17 14:05:01.603 Trades  'xxxxx': sell limit 1.00 LKOH-6.17 at 34098 placed for execution in 554.628 ms (195.343 ms on server)
2017.02.17 14:05:01.604 Trades  'xxxxx': accepted buy limit 3.00 MXI-6.17 at 2172.70
2017.02.17 14:05:01.604 Trades  'xxxxx': buy limit 3.00 MXI-6.17 at 2172.70 placed for execution in 537.273 ms (11.579 ms on server)
2017.02.17 14:05:01.608 Trades  'xxxxx': accepted sell limit 5.00 GBPU-6.17 at 1.2495
2017.02.17 14:05:02.012 Trades  'xxxxx': sell limit 5.00 GBPU-6.17 at 1.2495 placed for execution in 921.827 ms (1.396 ms on server)
2017.02.17 14:05:02.013 Trades  'xxxxx': accepted buy limit 5.00 HYDR-6.17 at 10779
2017.02.17 14:05:02.015 Trades  'xxxxx': accepted buy limit 2.00 MGNT-9.17 at 9611
2017.02.17 14:05:02.017 Trades  'xxxxx': accepted sell limit 2.00 MGNT-9.17 at 11001
2017.02.17 14:05:02.018 Trades  'xxxxx': accepted buy limit 1.00 ED-9.17 at 1.0601
2017.02.17 14:05:02.019 Trades  'xxxxx': buy limit 5.00 HYDR-6.17 at 10779 placed for execution in 929.618 ms (3.608 ms on server)
2017.02.17 14:05:02.022 Trades  'xxxxx': buy limit 2.00 MGNT-9.17 at 9611 placed for execution in 610.425 ms (3.848 ms on server)
2017.02.17 14:05:02.029 Trades  'xxxxx': sell limit 2.00 MGNT-9.17 at 11001 placed for execution in 616.804 ms (3.793 ms on server)
2017.02.17 14:05:02.030 Trades  'xxxxx': buy limit 1.00 ED-9.17 at 1.0601 placed for execution in 616.485 ms (3.712 ms on server)
2017.02.17 14:05:02.040 Trades  'xxxxx': cancel order #52607654 sell limit 1.00 LKOH-6.17 at 34098
2017.02.17 14:05:02.042 Trades  'xxxxx': accepted sell limit 1.00 ED-9.17 at 1.0849
2017.02.17 14:05:02.043 Trades  'xxxxx': sell limit 1.00 ED-9.17 at 1.0849 placed for execution in 629.309 ms (2.119 ms on server)
2017.02.17 14:05:02.215 Trades  'xxxxx': accepted buy limit 2.00 AUDU-6.17 at 0.7586
2017.02.17 14:05:02.216 Trades  'xxxxx': accepted buy limit 5.00 TATN-6.17 at 37027
2017.02.17 14:05:02.217 Trades  'xxxxx': accepted sell limit 5.00 AUDU-6.17 at 0.8025
2017.02.17 14:05:02.217 Trades  'xxxxx': buy limit 2.00 AUDU-6.17 at 0.7586 placed for execution in 793.001 ms (5.415 ms on server)
2017.02.17 14:05:02.519 Trades  'xxxxx': buy limit 5.00 TATN-6.17 at 37027 placed for execution in 1094.281 ms (5.535 ms on server)
2017.02.17 14:05:02.521 Trades  'xxxxx': sell limit 5.00 AUDU-6.17 at 0.8025 placed for execution in 1096.137 ms (5.514 ms on server)
2017.02.17 14:05:02.533 Trades  'xxxxx': accepted sell limit 5.00 TATN-6.17 at 42028
2017.02.17 14:05:02.533 Trades  'xxxxx': sell limit 5.00 TATN-6.17 at 42028 placed for execution in 1108.871 ms (1.341 ms on server)
 
prostotrader:

Das würde wahrscheinlichmehr Sinn machen.

Expertenprotokoll

2017.02.17 13:45:27.132 trader (RTS-3.17,M1)      COrder::Place: Order sent to server...
2017.02.17 13:45:27.141 trader (RTS-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
2017.02.17 13:45:27.421 trader (RTS-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE--> ORDER_STATE_PLACED -- > Order place done.

289 ms.

Terminal-Protokoll

2017.02.17 13:45:27.132 Trades  '1007932': buy limit 2.00 RTS-6.17 at 115190
2017.02.17 13:45:27.141 Trades  '1007932': accepted buy limit 2.00 RTS-6.17 at 115190
2017.02.17 13:45:27.141 Trades  '1007932': buy limit 2.00 RTS-6.17 at 115190 placed for execution in 8.526 ms

9 ms.

Die gleiche Farbe kennzeichnet die gleichen Ereignisse. Aus irgendeinem Grund steht in beiden Zeilen 27.141 im Terminalprotokoll.

Das Protokoll des Expert Advisors enthält 27.141 und sogar 27.421. Es scheint, dass OnTradeTransaction immer noch verlangsamt ist - das Ereignis wurde vom Terminal empfangen, aber erst nach >200 ms an OnTradeTransaction gesendet. Vielleicht hat der Expert Advisor in diesen 200 ms irgendetwas gemacht, und deshalb war er so verzögert. Das kann ich ohne den Quellcode nicht sagen.

 
fxsaber:

Die gleiche Farbe wurde zur Kennzeichnung der gleichen Ereignisse verwendet. Aus irgendeinem Grund steht in beiden Zeilen 27.141 im Terminalprotokoll.

Das Protokoll des Expert Advisors zeigt 27,141 und 27,421. Es scheint, dass OnTradeTransaction immer noch verlangsamt ist - das Ereignis wurde vom Terminal empfangen, aber erst nach >200 ms an OnTradeTransaction gesendet. Vielleicht hat der Expert Advisor in diesen 200 ms irgendetwas gemacht, und deshalb war er so verzögert. Das kann ich ohne den Quellcode nicht sagen.

Versuchen Sie dies mit dem Demo-Opener

//+------------------------------------------------------------------+
//|                                                   Test_delay.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

ulong order_ticket;
ulong Magic=1234567890;
ulong order_id;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetOrder();
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
                        const MqlTradeRequest &request,
                        const MqlTradeResult &result)
  {
   switch(trans.type)
     {
      case TRADE_TRANSACTION_REQUEST: if((order_id!=0) && (result.request_id==order_id))
        {
         order_ticket=result.order;
         Print(__FUNCTION__, ": TRADE_TRANSACTION_REQUEST --> Order got ticket.");
         order_id=0;
        }
      break;
      case TRADE_TRANSACTION_ORDER_UPDATE:  if((order_ticket!=0) && (trans.order==order_ticket))
        {
          switch(trans.order_state)
         {
          case ORDER_STATE_PLACED:
            Print(__FUNCTION__, ": TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Order place done.");
          break;
         }
        }
      break;
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetOrder()
  {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
   order_id=0;
   order_ticket=0;
   request.magic=Magic;
   request.symbol=Symbol();
   request.volume=1;
   request.type_filling=ORDER_FILLING_RETURN;
   request.type_time=ORDER_TIME_DAY;
   request.action=TRADE_ACTION_PENDING;
   request.type=ORDER_TYPE_SELL_LIMIT;
   request.comment="";
   request.price=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_PRICE_LIMIT_MAX);
   if(OrderSendAsync(request,result))
     {
      if((result.retcode==TRADE_RETCODE_PLACED) || (result.retcode==TRADE_RETCODE_DONE))
        {
         order_id=result.request_id;
         Print(__FUNCTION__, ": Order send to server.");
        }
     }
   else
     {Print("Order not send.");}
  }
//+------------------------------------------------------------------+

Das Terminalprotokoll

2017.02.17 14:48:33.361 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121900
2017.02.17 14:48:33.368 Trades  '1007932': accepted sell limit 1.00 RTS-3.17 at 121900
2017.02.17 14:48:33.369 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121900 placed for execution in 8.077 ms

8 ms.

Expertenprotokoll.

2017.02.17 14:48:33.361 Test_delay (RTS-3.17,M1)        SetOrder: Order send to server.
2017.02.17 14:48:33.369 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
2017.02.17 14:48:33.377 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Order place done.

16 ms.

Wo ist das "TORRIBLE" des Experten?

 

Nun wird die Aufgabe durch die Hinzufügung der synchronen Auftragseinstellung verkompliziert

//+------------------------------------------------------------------+
//|                                                   Test_delay.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

ulong order_ticket;
ulong sync_order;
ulong Magic=1234567890;
ulong order_id;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetOrder();
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
                        const MqlTradeRequest &request,
                        const MqlTradeResult &result)
  {
   switch(trans.type)
     {
      case TRADE_TRANSACTION_REQUEST: if((order_id!=0) && (result.request_id==order_id))
        {
         order_ticket=result.order;
         Print(__FUNCTION__, ": TRADE_TRANSACTION_REQUEST --> Order got ticket.");
         order_id=0;
        }
      break;
      case TRADE_TRANSACTION_ORDER_UPDATE:  if((order_ticket>0) && (trans.order==order_ticket))
        {
          switch(trans.order_state)
         {
          case ORDER_STATE_PLACED:
            Print(__FUNCTION__, ": TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.");
            SetSyncOrder();
          break;
         }
        }
        else
        if((sync_order>0) && (trans.order==sync_order))
          {
             switch(trans.order_state)
           {
            case ORDER_STATE_PLACED:
              Print(__FUNCTION__, ": TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done. And found in terminal.");
            break;
           }
          }
        
      break;
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetSyncOrder()
  {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
   order_id=0;
   sync_order=0;
   request.magic=Magic;
   request.symbol=Symbol();
   request.volume=1;
   request.type_filling=ORDER_FILLING_RETURN;
   request.type_time=ORDER_TIME_DAY;
   request.action=TRADE_ACTION_PENDING;
   request.type=ORDER_TYPE_SELL_LIMIT;
   request.comment="";
   request.price=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_PRICE_LIMIT_MAX);
   Print(__FUNCTION__, ": Sync Order send to server...");
   if(OrderSend(request,result))
     {
      if((result.retcode==TRADE_RETCODE_PLACED) || (result.retcode==TRADE_RETCODE_DONE))
        {
         sync_order=result.order;
         Print(__FUNCTION__, ": Sync Order place done? but nof found in terminal.");
        }
     }
   else
     {Print("Order not send.");}
  }
  //---------------------
  void SetOrder()
  {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
   order_id=0;
   order_ticket=0;
   request.magic=Magic;
   request.symbol=Symbol();
   request.volume=1;
   request.type_filling=ORDER_FILLING_RETURN;
   request.type_time=ORDER_TIME_DAY;
   request.action=TRADE_ACTION_PENDING;
   request.type=ORDER_TYPE_SELL_LIMIT;
   request.comment="";
   request.price=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_PRICE_LIMIT_MAX);
   Print(__FUNCTION__, ": Async Order send to server...");
   if(OrderSendAsync(request,result))
     {
      if((result.retcode==TRADE_RETCODE_PLACED) || (result.retcode==TRADE_RETCODE_DONE))
        {
         order_id=result.request_id;
         Print(__FUNCTION__, ": Async Order got request ID.");
        }
     }
   else
     {Print("Order not send.");}
  }
//+------------------------------------------------------------------+

Terminal-Protokoll

2017.02.17 15:17:15.279 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121900
2017.02.17 15:17:15.292 Trades  '1007932': accepted sell limit 1.00 RTS-3.17 at 121900
2017.02.17 15:17:15.292 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121900 placed for execution in 13.559 ms
2017.02.17 15:17:15.297 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121900
2017.02.17 15:17:15.308 Trades  '1007932': accepted sell limit 1.00 RTS-3.17 at 121900
2017.02.17 15:17:15.310 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121900 placed for execution
2017.02.17 15:17:15.317 Trades  '1007932': order #54040029 sell limit 1.00 / 1.00 RTS-3.17 at 121900 done in 19.853 ms

Asynchroner Modus - 13 ms.(zur Ausführungbestimmt)

Synchron - 20 ms.

Expert Advisor Log


2017.02.17 15:17:15.277 Test_delay (RTS-3.17,M1)        SetOrder: Async Order send to server...
2017.02.17 15:17:15.279 Test_delay (RTS-3.17,M1)        SetOrder: Async Order got request ID.
2017.02.17 15:17:15.292 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
2017.02.17 15:17:15.297 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.
2017.02.17 15:17:15.297 Test_delay (RTS-3.17,M1)        SetSyncOrder: Sync Order send to server...
2017.02.17 15:17:15.317 Test_delay (RTS-3.17,M1)        SetSyncOrder: Sync Order place done? but nof found in terminal.
2017.02.17 15:17:15.317 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done. And found in terminal.

Asynchroner Modus - 20 ms. (Wo Terminal 7 ms zu tun ????)

Synchroner Modus - 20 msec.

 

Wir werden nie in der Lage sein, den Grund für die Verzögerungen selbst herauszufinden,

Denn die Verbindung für FORTS ist wie folgt:

Terminal --> Internet --> Broker Netzwerk --> MT5 Server --> Broker Netzwerk --> Internet - Terminal

Solange die Entwickler selbst nicht bereit sind, mit den Verzögerungen umzugehen, wird es so sein.

 
prostotrader:

Um die Aufgabe zu verkomplizieren, fügen Sie nun eine synchrone Auftragseinstellung hinzu

CI      0       14:59:53.943    Trades  '5122740': sell limit 1.00 MIX-3.17 at 225925
KL      0       14:59:53.997    Trades  '5122740': accepted sell limit 1.00 MIX-3.17 at 225925
OH      0       14:59:54.025    Trades  '5122740': order #134542376 sell limit 1.00 / 1.00 MIX-3.17 at market done in 82.884 ms
JF      0       14:59:54.026    Trades  '5122740': sell limit 1.00 MIX-3.17 at 225925
KM      0       14:59:54.082    Trades  '5122740': accepted sell limit 1.00 MIX-3.17 at 225925
PI      0       14:59:54.082    Trades  '5122740': order #134542377 sell limit 1.00 / 1.00 MIX-3.17 at market done in 57.025 ms
EN      0       14:59:53.942    Test (MIX-3.17,M1)      SetOrder: Async Order send to server...
PP      0       14:59:53.943    Test (MIX-3.17,M1)      SetOrder: Async Order got request ID.
JF      0       14:59:54.025    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
GP      0       14:59:54.026    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.
KD      0       14:59:54.026    Test (MIX-3.17,M1)      SetSyncOrder: Sync Order send to server...
JM      0       14:59:54.082    Test (MIX-3.17,M1)      SetSyncOrder: Sync Order place done? but nof found in terminal.
DE      0       14:59:54.082    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done. And found in terminal.

MQ-Demo.

 
prostotrader:

Wir werden nie in der Lage sein, den Grund für die Verzögerungen selbst herauszufinden,

Denn die Verbindung für FORTS ist wie folgt:

Terminal --> Internet --> Broker Netzwerk --> MT5 Server --> Broker Netzwerk --> Internet - Terminal

Solange die Entwickler selbst nicht bereit sind, mit den Verzögerungen umzugehen, wird es so sein.

Nun, es gibt Bremsen auf MQ-Demo, also werden sie diese beseitigen. Und 100% weniger Lags auf anderen Servern.
 
fxsaber:

CI      0       14:59:53.943    Trades  '5122740': sell limit 1.00 MIX-3.17 at 225925
KL      0       14:59:53.997    Trades  '5122740': accepted sell limit 1.00 MIX-3.17 at 225925
OH      0       14:59:54.025    Trades  '5122740': order #134542376 sell limit 1.00 / 1.00 MIX-3.17 at market done in 82.884 ms
JF      0       14:59:54.026    Trades  '5122740': sell limit 1.00 MIX-3.17 at 225925
KM      0       14:59:54.082    Trades  '5122740': accepted sell limit 1.00 MIX-3.17 at 225925
PI      0       14:59:54.082    Trades  '5122740': order #134542377 sell limit 1.00 / 1.00 MIX-3.17 at market done in 57.025 ms
EN      0       14:59:53.942    Test (MIX-3.17,M1)      SetOrder: Async Order send to server...
PP      0       14:59:53.943    Test (MIX-3.17,M1)      SetOrder: Async Order got request ID.
JF      0       14:59:54.025    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
GP      0       14:59:54.026    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.
KD      0       14:59:54.026    Test (MIX-3.17,M1)      SetSyncOrder: Sync Order send to server...
JM      0       14:59:54.082    Test (MIX-3.17,M1)      SetSyncOrder: Sync Order place done? but nof found in terminal.
DE      0       14:59:54.082    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done. And found in terminal.

MQ-Demo.

Gibt es daran keinen Zweifel?

JF      0       14:59:54.025    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
GP      0       14:59:54.026    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.

1ms - NEIN!

Prüfen Sie erneut.

Hinzugefügt

Ich habe mit dem Build 1525 getestet.

 
prostotrader:

Gibt es hieran irgendwelche Zweifel?

JF      0       14:59:54.025    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
GP      0       14:59:54.026    Test (MIX-3.17,M1)      OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.

1ms - NEIN!

Der einzige Zweifel, den ich habe, ist die Zeit, die das Terminal selbst protokolliert.

Aus diesem Grund habe ich Folgendes getan

//+------------------------------------------------------------------+
//|                                                   Test_delay.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

ulong order_ticket;
ulong sync_order;
ulong Magic=1234567890;
ulong order_id;

ulong StartTime;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   StartTime = GetMicrosecondCount();
  
   SetOrder();
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
                        const MqlTradeRequest &request,
                        const MqlTradeResult &result)
  {
   switch(trans.type)
     {
      case TRADE_TRANSACTION_REQUEST: if((order_id!=0) && (result.request_id==order_id))
        {
         Print(DoubleToString((GetMicrosecondCount() - StartTime) / 1000.0, 3));
         order_ticket=result.order;
         Print(__FUNCTION__, ": TRADE_TRANSACTION_REQUEST --> Order got ticket.");
         order_id=0;
        }
      break;
      case TRADE_TRANSACTION_ORDER_UPDATE:  if((order_ticket>0) && (trans.order==order_ticket))
        {
          switch(trans.order_state)
         {
          case ORDER_STATE_PLACED:
            Print(DoubleToString((GetMicrosecondCount() - StartTime) / 1000.0, 3));
            
            Print(__FUNCTION__, ": TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.");
            
            SetSyncOrder();
          break;
         }
        }
        else
        if((sync_order>0) && (trans.order==sync_order))
          {
             switch(trans.order_state)
           {
            case ORDER_STATE_PLACED:
              Print(DoubleToString((GetMicrosecondCount() - StartTime) / 1000.0, 3));            
              
              Print(__FUNCTION__, ": TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done. And found in terminal.");
            break;
           }
          }
        
      break;
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetSyncOrder()
  {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
   order_id=0;
   sync_order=0;
   request.magic=Magic;
   request.symbol=Symbol();
   request.volume=1;
   request.type_filling=ORDER_FILLING_RETURN;
   request.type_time=ORDER_TIME_DAY;
   request.action=TRADE_ACTION_PENDING;
   request.type=ORDER_TYPE_SELL_LIMIT;
   request.comment="";
   request.price=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_PRICE_LIMIT_MAX);
   Print(__FUNCTION__, ": Sync Order send to server...");

   StartTime = GetMicrosecondCount();
  
   if(OrderSend(request,result))
     {
      if((result.retcode==TRADE_RETCODE_PLACED) || (result.retcode==TRADE_RETCODE_DONE))
        {
         sync_order=result.order;
         Print(__FUNCTION__, ": Sync Order place done? but nof found in terminal.");
        }
     }
   else
     {Print("Order not send.");}
  }
  //---------------------
  void SetOrder()
  {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
   order_id=0;
   order_ticket=0;
   request.magic=Magic;
   request.symbol=Symbol();
   request.volume=1;
   request.type_filling=ORDER_FILLING_RETURN;
   request.type_time=ORDER_TIME_DAY;
   request.action=TRADE_ACTION_PENDING;
   request.type=ORDER_TYPE_SELL_LIMIT;
   request.comment="";
   request.price=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_PRICE_LIMIT_MAX);
   Print(__FUNCTION__, ": Async Order send to server...");

   StartTime = GetMicrosecondCount();
  
   if(OrderSendAsync(request,result))
     {
      if((result.retcode==TRADE_RETCODE_PLACED) || (result.retcode==TRADE_RETCODE_DONE))
        {
         order_id=result.request_id;
         Print(__FUNCTION__, ": Async Order got request ID.");
        }
     }
   else
     {Print("Order not send.");}
  }
//+------------------------------------------------------------------+

Was bekommen Sie?

 
fxsaber:

Was bekommen Sie?

2017.02.17 16:20:47.292 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121520
2017.02.17 16:20:47.299 Trades  '1007932': accepted sell limit 1.00 RTS-3.17 at 121520
2017.02.17 16:20:47.300 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121520 placed for execution in 8.287 ms
2017.02.17 16:20:47.307 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121520
2017.02.17 16:20:47.315 Trades  '1007932': accepted sell limit 1.00 RTS-3.17 at 121520
2017.02.17 16:20:47.316 Trades  '1007932': sell limit 1.00 RTS-3.17 at 121520 placed for execution
2017.02.17 16:20:47.323 Trades  '1007932': order #54042531 sell limit 1.00 / 1.00 RTS-3.17 at 121520 done in 15.978 ms


2017.02.17 16:17:57.121 Test_delay (RTS-3.17,M1)        SetOrder: Async Order send to server...
2017.02.17 16:17:57.122 Test_delay (RTS-3.17,M1)        SetOrder: Async Order got request ID.
2017.02.17 16:17:57.132 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
2017.02.17 16:17:57.146 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.
2017.02.17 16:17:57.146 Test_delay (RTS-3.17,M1)        SetSyncOrder: Sync Order send to server...
2017.02.17 16:17:57.161 Test_delay (RTS-3.17,M1)        SetSyncOrder: Sync Order place done, but not found in terminal.
2017.02.17 16:17:57.161 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done and found in terminal.
2017.02.17 16:20:47.291 Test_delay (RTS-3.17,M1)        SetOrder: Async Order send to server...
2017.02.17 16:20:47.292 Test_delay (RTS-3.17,M1)        SetOrder: Async Order got request ID.
2017.02.17 16:20:47.300 Test_delay (RTS-3.17,M1)        8.305
2017.02.17 16:20:47.300 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_REQUEST --> Order got ticket.
2017.02.17 16:20:47.307 Test_delay (RTS-3.17,M1)        15.644
2017.02.17 16:20:47.307 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Async Order place done.
2017.02.17 16:20:47.307 Test_delay (RTS-3.17,M1)        SetSyncOrder: Sync Order send to server...
2017.02.17 16:20:47.323 Test_delay (RTS-3.17,M1)        SetSyncOrder: Sync Order place done? but nof found in terminal.
2017.02.17 16:20:47.323 Test_delay (RTS-3.17,M1)        16.033
2017.02.17 16:20:47.323 Test_delay (RTS-3.17,M1)        OnTradeTransaction: TRADE_TRANSACTION_ORDER_UPDATE --> ORDER_STATE_PLACED --> Sync order place done. And found in terminal.

Bild 1533.

Hinzugefügt

Welchen Sinn hat die Zeitmessung? Wie kann die Ortszeit in einem so kleinen Zeitrahmen genau sein?