The messy OnTrade() on Strategy Tester

 

Some time ago I made this to test how OnTrade() acts on Strategy Tester. 

The EA sets pending buys and sells at a fixed distance. There is no other action in the EA, the log contains only what OnTrade() reports. 

Check out the log and tell me what you think!... Cause I can't understand it...

 

Some samples:

 RR 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 OnTrade() reporting to duty!
MD 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::History loaded and has 1 entries. Looking for LastDealTicket=1
QD 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
HN 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::Selected ticket is LastDealTicket (reported) (=1)
DL 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::Enumerating from 0 to 0 included
RF 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 Index 0 ticket=1 : DEAL_TYPE_BUY
RE 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 OnTrade() reporting to duty!
MK 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::History loaded and has 1 entries. Looking for LastDealTicket=1
QK 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
HG 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::Selected ticket is LastDealTicket (reported) (=1)
DK 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::Enumerating from 0 to 0 included
RI 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 Index 0 ticket=1 : DEAL_TYPE_BUY
RL 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 OnTrade() reporting to duty!
MR 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::History loaded and has 1 entries. Looking for LastDealTicket=1
QR 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
HL 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::Selected ticket is LastDealTicket (reported) (=1)
DR 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 ::Enumerating from 0 to 0 included
RP 0 OnTradeStressTest (EURUSD,M1) 12:29:55 2010.01.04 00:00:00 Index 0 ticket=1 : DEAL_TYPE_BUY

 ... continues for pages....

 

 PN 0 Trade 12:29:56 2010.01.04 10:35:34 order [#4 buy stop 0.10 EURUSD at 1.43768] triggered
FO 0 Trades 12:29:56 2010.01.04 10:35:34 deal #4 buy 0.10 EURUSD at 1.43768 done (based on order #4)
QL 0 Trade 12:29:56 2010.01.04 10:35:34 deal performed [#4 buy 0.10 EURUSD at 1.43768]
PF 0 Trade 12:29:56 2010.01.04 10:35:34 order performed buy 0.10 at 1.43768 [#4 buy stop 0.10 EURUSD at 1.43768]
MK 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 OnTrade() reporting to duty!
MM 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 ::History loaded and has 4 entries. Looking for LastDealTicket=1
NM 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
OH 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 ::Selected ticket is LastDealTicket (reported) (=1)
RF 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 ::Enumerating from 0 to 3 included
MO 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 Index 0 ticket=1 : DEAL_TYPE_BUY
KR 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 Index 1 ticket=2 : DEAL_TYPE_BALANCE
EQ 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 Index 2 ticket=3 : DEAL_TYPE_BUY
GH 0 OnTradeStressTest (EURUSD,M1) 12:29:56 2010.01.04 10:35:34 Index 3 ticket=4 : DEAL_TYPE_SELL

P.S. This time I put the "full" version of the log. 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties - Documentation on MQL5
Files:
20100830.log  304 kb
 
I have answered you in your request. Your code has one error.

 
Unfortunatelly you don't admit your own mistakes.

 

I saw it , Rosh. Think it passed me because it used to work on manual testing (placing trades manually generated triggering from the EA).

I also answered on the other ticket concerning the No prices error. There was a reason for the false used in SymbolName call.

There is also an interesting asymetry in the behaviour of SymbolsTotal() behaviour, which is not the same between forward testing and backtester

 

Now things look much cool. I couldn't believe the problem was the Print line from the EnumDealsCallback and the rest of the class is fine:

So, log looks like:

IL 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 OnTrade() reporting to duty!
FR 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::History loaded and has 1 entries. Looking for LastDealTicket=1
JQ 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
CL 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::Selected ticket is LastDealTicket (reported) (=1)
CR 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::Enumerating from 0 to 0 included
QS 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 Index 0 ticket=1 : DEAL_TYPE_BALANCE
QF 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 OnTrade() reporting to duty!
NH 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::History loaded and has 1 entries. Looking for LastDealTicket=1
RH 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
KE 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::Selected ticket is LastDealTicket (reported) (=1)
KI 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::Enumerating from 0 to 0 included
IJ 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 Index 0 ticket=1 : DEAL_TYPE_BALANCE
II 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 OnTrade() reporting to duty!
FO 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::History loaded and has 1 entries. Looking for LastDealTicket=1
JN 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
CK 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::Selected ticket is LastDealTicket (reported) (=1)
CG 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 ::Enumerating from 0 to 0 included
QL 0 OnTradeStressTest (EURUSD,H1) 19:21:01 2010.01.04 00:00:00 Index 0 ticket=1 : DEAL_TYPE_BALANCE
....

RJ 0 Trade 19:21:02 2010.01.04 09:52:33 order [#2 buy stop 0.10 EURUSD at 1.43368] triggered
JS 0 Trades 19:21:02 2010.01.04 09:52:33 deal #2 buy 0.10 EURUSD at 1.43368 done (based on order #2)
OP 0 Trade 19:21:02 2010.01.04 09:52:33 deal performed [#2 buy 0.10 EURUSD at 1.43368]
FJ 0 Trade 19:21:02 2010.01.04 09:52:33 order performed buy 0.10 at 1.43368 [#2 buy stop 0.10 EURUSD at 1.43368]
JG 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 OnTrade() reporting to duty!
DI 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::History loaded and has 2 entries. Looking for LastDealTicket=1
II 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
LE 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::Selected ticket is LastDealTicket (reported) (=1)
KI 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::Enumerating from 0 to 1 included
RK 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 Index 0 ticket=1 : DEAL_TYPE_BALANCE
HN 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 Index 1 ticket=2 : DEAL_TYPE_BUY
JM 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 OnTrade() reporting to duty!
DS 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::History loaded and has 2 entries. Looking for LastDealTicket=1
IS 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
LO 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::Selected ticket is LastDealTicket (reported) (=1)
KS 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::Enumerating from 0 to 1 included
RQ 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 Index 0 ticket=1 : DEAL_TYPE_BALANCE
HD 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 Index 1 ticket=2 : DEAL_TYPE_BUY
JK 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 OnTrade() reporting to duty!
DM 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::History loaded and has 2 entries. Looking for LastDealTicket=1
IM 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::There were previous reports. Selected deal ticket 1 having entry 0 in the HistorySelect queue
LI 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::Selected ticket is LastDealTicket (reported) (=1)
KE 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 ::Enumerating from 0 to 1 included
RO 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 Index 0 ticket=1 : DEAL_TYPE_BALANCE
HR 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 09:52:33 Index 1 ticket=2 : DEAL_TYPE_BUY
KP 0 Trade 19:21:02 2010.01.04 10:31:04 order [#3 sell limit 0.10 EURUSD at 1.43568] triggered
CG 0 Trades 19:21:02 2010.01.04 10:31:04 deal #3 sell 0.10 EURUSD at 1.43568 done (based on order #3)
KJ 0 Trade 19:21:02 2010.01.04 10:31:04 deal performed [#3 sell 0.10 EURUSD at 1.43568]
MN 0 Trade 19:21:02 2010.01.04 10:31:04 order performed sell 0.10 at 1.43568 [#3 sell limit 0.10 EURUSD at 1.43568]
GR 0 OnTradeStressTest (EURUSD,H1) 19:21:02 2010.01.04 10:31:04 OnTrade() reporting to duty!

 Conclusions:

1. The order of the trades is okay.

2. There are a lot of calls at the beginning, when nothing happens.

3. There are 3 calls per order execution. 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties - Documentation on MQL5
 
TheEconomist said "There are a lot of calls at the beginning, when nothing happens.".
Yes, and I know these matter is not working in Demo account (not tester), too.

Basically, OnTrade events is useful for event-driven program, if it works correctly.
I want to check "Pending order fill" or "OrderSend command is completed" in OnTrade events procedure from EA.
It helps to eliminate "Loop and check" routine from program, it is smart way.

But now, when OnTrade events happened, no guarantee to read the History (Deals History, Orders History) in it.
I wonder why MT5 (and tester) cause the OnTrade events without any history update.

EA has NOTHING to do in this event, now.

In the documents of MQL5 Reference, OnTrade events should appear when changes of "the history of orders and history of deals".

Please implement correct code based on this specification.

 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 
Shimarin:

In the documents of MQL5 Reference, OnTrade events should appear when changes of "the history of orders and history of deals".

We will remove or alter the line. It is not guaranteed that the list of deals and orders in history will be updated immediately after the trade operation. This may take some time.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Trade Operation Types - Documentation on MQL5
 
Rosh:
 It is not guaranteed that the list of deals and orders in history will be updated immediately after the trade operation . 

Therefore, OnTrade just pops when a trade is made, and not even the history mechanisms can retrieve what trade has been done, rendering unuseful the history check as a workaround for the lack of OnTrade parameters.

Question: is this "not guaranteed update" happening on forward testing, backtester or both? 

 

This is a newer version of the DealHandler class - in the assumption that history selection works.

class DealHandler
  {
   private:
   int LastDealIndex;
   ulong LastDealTicket;
   datetime LastDealTime;      
   bool setup;
 
   public:
   bool IsSetup();
   void Setup();
   void ReportDeals();
 
   //sadly, virtual methods must reside in the class body
   virtual void EnumDealsCallback(int fromindex,int toindex) 
      {
       int type;
       string dealtype; 
       for (int i=fromindex;i<=toindex;i++)
          {
           ulong ticket=HistoryDealGetTicket(i);
           type=HistoryDealGetInteger(ticket,DEAL_TYPE); 
           //this code is embedded here to remove class dependancy; in the finalversion there will be
           //dealtype=ENUM_DEAL_TYPE_ToString(type);
           switch(type)
             {
              case DEAL_TYPE_BUY:dealtype="DEAL_TYPE_BUY";
              case DEAL_TYPE_SELL:dealtype="DEAL_TYPE_SELL";
              case DEAL_TYPE_BALANCE:dealtype="DEAL_TYPE_BALANCE";
              case DEAL_TYPE_CREDIT:dealtype="DEAL_TYPE_CREDIT";
              case DEAL_TYPE_CHARGE:dealtype="DEAL_TYPE_CHARGE";
              case DEAL_TYPE_CORRECTION:dealtype="DEAL_TYPE_CORRECTION";
              default: dealtype="N.A.";
             } 
           //your code goes here...
           Print("Index ",i," ticket=",ticket," : ",dealtype);
           //up to here... 
          }
       return;
      } 
 
   DealHandler()
      {
       setup=false;
       Setup();
       return;
      }
   };//DealHandler class end
 
    bool DealHandler::IsSetup()
      {
       return(setup);
      }
 
    void DealHandler::Setup()
      {
       HistorySelect(0,TimeCurrent()+5*60);
       LastDealIndex=HistoryDealsTotal()-1;
       if (LastDealIndex!=-1)
         {
          LastDealTicket=HistoryDealGetTicket(LastDealIndex);
          LastDealTime=HistoryDealGetInteger(LastDealTicket,DEAL_TIME);
          if (TerminalInfoInteger(TERMINAL_CONNECTED)==true)
            setup=true;
          else
            setup=false;
         }   
       else       
         {
          LastDealTicket=0;
          LastDealTime=0;
          setup=false;
         }
       return;
      }       
 
    void DealHandler::ReportDeals()
       {
        datetime dtime;
        ulong ticket;
        int lasti;
        bool loaded;
        if (setup==false)
          {
           Setup();
           return;
          }
        lasti=0;
        loaded=HistorySelect(LastDealTime,TimeCurrent()+5*60);
        if (HistoryDealsTotal()==0||loaded==false)
          return;
        lasti=0;
        if (HistoryDealsTotal()-1<LastDealIndex) //damn, some part of history has been removed
          {
           for (int i=0;i<HistoryDealsTotal();i--)
              {
               ticket=HistoryDealGetTicket(i);
               if (ticket==LastDealTicket)
                 {
                  lasti=i+1;
                  break;
                 }               
              }
           if (lasti!=0)
             {
              if (lasti<HistoryDealsTotal())                
                {
                 EnumDealsCallback(lasti,HistoryDealsTotal()-1);
                 LastDealIndex=HistoryDealsTotal()-1;
                 LastDealTicket=HistoryDealGetTicket(LastDealIndex);
                 LastDealTime=HistoryDealGetInteger(LastDealTicket,DEAL_TIME);
                }
             }
          }
        else
          {
           if (HistoryDealsTotal()-1==LastDealIndex) 
             {//possible limited history to a fixed number of deals
              //or a multiple OnTrade() triggers per deal
              for (int i=HistoryDealsTotal()-1;i>=0;i--)
                 {
                  ticket=HistoryDealGetTicket(i);
                  if (ticket==LastDealTicket)
                    {
                     lasti=i+1;
                     break;
                    }                  
                 }
              if (lasti!=0)
                {
                 if (lasti<HistoryDealsTotal())                
                   {
                    EnumDealsCallback(lasti,HistoryDealsTotal()-1);
                    LastDealIndex=HistoryDealsTotal()-1;
                    LastDealTicket=HistoryDealGetTicket(LastDealIndex);
                    LastDealTime=HistoryDealGetInteger(LastDealTicket,DEAL_TIME);
                   }
                }              
             }
           else
             {
              if (HistoryDealsTotal()-1>LastDealIndex) //current index is larger; simple selection;
                {
                 EnumDealsCallback(LastDealIndex+1,HistoryDealsTotal()-1);
                 LastDealIndex=HistoryDealsTotal()-1;
                 LastDealTicket=HistoryDealGetTicket(LastDealIndex);
                 LastDealTime=HistoryDealGetInteger(LastDealTicket,DEAL_TIME);
                }
             }//else if (HistoryDealsTotal()-1==LastDealIndex) 
          }//if (HistoryDealsTotal()-1<LastDealIndex)
        return;
    };

 And resultant log of the same EA:

....

EQ 0 Core 1 19:03:26 2010.01.04 00:00:00 OnTrade() reporting to duty!
OF 0 Core 1 19:03:26 2010.01.04 00:00:00 OnTrade() reporting to duty!
QO 0 Core 1 19:03:26 2010.01.04 00:00:00 OnTrade() reporting to duty!
KD 0 Core 1 19:03:26 2010.01.04 00:00:00 OnTrade() reporting to duty!
NM 0 Core 1 19:03:27 2010.01.04 00:00:00 OnTrade() reporting to duty!
HS 0 Core 1 19:03:27 2010.01.04 00:00:00 OnTrade() reporting to duty!
JH 0 Core 1 19:03:27 2010.01.04 00:00:00 OnTrade() reporting to duty!
DQ 0 Core 1 19:03:27 2010.01.04 00:00:00 OnTrade() reporting to duty!
MK 0 Core 1 19:03:27 2010.01.04 09:52:33 order [#2 buy stop 0.10 EURUSD at 1.43368] triggered
RE 0 Core 1 19:03:27 2010.01.04 09:52:33 deal #2 buy 0.10 EURUSD at 1.43368 done (based on order #2)
JO 0 Core 1 19:03:27 2010.01.04 09:52:33 deal performed [#2 buy 0.10 EURUSD at 1.43368]
MS 0 Core 1 19:03:27 2010.01.04 09:52:33 order performed buy 0.10 at 1.43368 [#2 buy stop 0.10 EURUSD at 1.43368]
FE 0 Core 1 19:03:27 2010.01.04 09:52:33 OnTrade() reporting to duty!
NJ 0 Core 1 19:03:27 2010.01.04 09:52:33 Index 1 ticket=2 : DEAL_TYPE_BUY
RP 0 Core 1 19:03:27 2010.01.04 09:52:33 OnTrade() reporting to duty!
PI 0 Core 1 19:03:27 2010.01.04 09:52:33 OnTrade() reporting to duty!
RR 0 Core 1 19:03:27 2010.01.04 10:31:04 order [#3 sell limit 0.10 EURUSD at 1.43568] triggered
QR 0 Core 1 19:03:27 2010.01.04 10:31:04 deal #3 sell 0.10 EURUSD at 1.43568 done (based on order #3)
LK 0 Core 1 19:03:27 2010.01.04 10:31:04 deal performed [#3 sell 0.10 EURUSD at 1.43568]
LD 0 Core 1 19:03:27 2010.01.04 10:31:04 order performed sell 0.10 at 1.43568 [#3 sell limit 0.10 EURUSD at 1.43568]
HJ 0 Core 1 19:03:28 2010.01.04 10:31:04 OnTrade() reporting to duty!
GN 0 Core 1 19:03:28 2010.01.04 10:31:04 Index 1 ticket=3 : DEAL_TYPE_SELL
NI 0 Core 1 19:03:28 2010.01.04 10:31:04 OnTrade() reporting to duty!
HN 0 Core 1 19:03:28 2010.01.04 10:31:04 OnTrade() reporting to duty!
HJ 0 Core 1 19:03:28 2010.01.04 10:35:34 order [#4 buy stop 0.10 EURUSD at 1.43768] triggered
QD 0 Core 1 19:03:28 2010.01.04 10:35:34 deal #4 buy 0.10 EURUSD at 1.43768 done (based on order #4)
CL 0 Core 1 19:03:28 2010.01.04 10:35:34 deal performed [#4 buy 0.10 EURUSD at 1.43768]
DQ 0 Core 1 19:03:28 2010.01.04 10:35:34 order performed buy 0.10 at 1.43768 [#4 buy stop 0.10 EURUSD at 1.43768]
IR 0 Core 1 19:03:28 2010.01.04 10:35:34 OnTrade() reporting to duty!
KK 0 Core 1 19:03:28 2010.01.04 10:35:34 Index 1 ticket=4 : DEAL_TYPE_BUY
EQ 0 Core 1 19:03:28 2010.01.04 10:35:34 OnTrade() reporting to duty!
CF 0 Core 1 19:03:28 2010.01.04 10:35:34 OnTrade() reporting to duty!
LS 0 Core 1 19:03:28 2010.01.04 11:15:51 order [#5 sell limit 0.10 EURUSD at 1.43968] triggered
IP 0 Core 1 19:03:28 2010.01.04 11:15:51 deal #5 sell 0.10 EURUSD at 1.43968 done (based on order #5)
RJ 0 Core 1 19:03:28 2010.01.04 11:15:51 deal performed [#5 sell 0.10 EURUSD at 1.43968]
FG 0 Core 1 19:03:28 2010.01.04 11:15:51 order performed sell 0.10 at 1.43968 [#5 sell limit 0.10 EURUSD at 1.43968]
RK 0 Core 1 19:03:28 disconnected

We have a lot of "OnTrade reporting to duty!" from the main EA, inside the OnTrade method. However the class code does not list DEAL_TYPE_BALANCE, considering this entry was the initial one in the queue. We have 3 "Index n ticket" entries indicating executed deals, mingled with other "OnTrade reporting to duty!" that are not followed by anything, because history is not updated. Looks pretty fine.
 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties - Documentation on MQL5