OrderSendAsync

OrderSendAsync() 函数用于指导不同步的 交易操作 ,无需等待交易服务器对发送请求的回应。该函数专为高频交易设计,根据交易算法,无法接受浪费时间等候来自服务器的回应。

bool  OrderSendAsync(
   MqlTradeRequest&  request,      // 请求架构
   MqlTradeResult&   result        // 请求架构
   );

参数

request

[in]  描述客户交易行为的MqlTradeRequest 类型架构的指针。

result

[in,out]  函数成功执行时(如果返回true),描述交易操作结果的MqlTradeResult类型结构的指针。

返回值

如果请求发送到交易服务器返回true。如果请求没有发送,它返回false。如果请求被发送,result 变量中反馈代码包含TRADE_RETCODE_PLACED 值(代码 10008) – "已下单"。成功执行意味着只是发送的事实,但是不保证请求到达交易服务器和已被接受处理。当处理接收的请求时,交易服务器向客户端发送回应,通知引起生成交易事件的持仓当前状态,订单和交易的变化。

在通过OrderSendAsync()函数发送的服务器上执行交易请求的结果可以通过OnTradeTransaction处理程序跟踪。应该注意,当执行交易请求时,将会多次调用OnTradeTransaction处理程序。

例如,当发送市场买入订单时,它会被处理,为账户创建一个适当的买入订单,然后执行订单并从持仓订单列表中移除,然后它被添加到订单历史记录,相应的交易也被添加到历史记录并创建新持仓。OnTradeTransaction函数将会为这里每个事件进行调用。若要获得这种数据,应该分析函数参数:

  • trans - 该参数获取描述应用到交易账户的交易事务的 MqlTradeTransaction 架构;
  • request - 该参数获取描述一个交易事务得出的交易请求的 MqlTradeRequest 架构;
  • result - 该参数获取描述交易请求执行结果的 MqlTradeResult 架构。

注意

根据意图和参数,该函数类似OrderSend(),但是又不一样,它是非同步的,例如,等候函数执行结果时不保持程序操作。您可以使用EA交易样本比较这两个函数交易操作的比率。

例如:

#property description "Expert Advisor for sending trade requests "
                      " using OrderSendAsync() function.\r\n"
#property description "Handling trading events using"
                      " OnTrade() and OnTradeTransaction() handler functions is displayed\r\n"
#property description "Expert Advisor parameters allow setting Magic Number"
                      " (unique ID) "
#property description "and the mode of displaying messages in Experts log. All details are displayed by default.\r\n"
//--- 输入参数
input int  MagicNumber=1234567;      // EA交易 ID
input bool DescriptionModeFull=true// 详细的输出模式
//--- HistorySelect()调用使用的变量
datetime history_start;
//+------------------------------------------------------------------+
//| 专家初始化函数                                                     |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- 检查是否允许自动交易
   if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))
     {
      Alert("Autotrading in the terminal is disabled, Expert Advisor will be removed.");
      ExpertRemove();
      return(-1);
     }
//--- 不能交易真实账户
   if(AccountInfoInteger(ACCOUNT_TRADE_MODE)==ACCOUNT_TRADE_MODE_REAL)
     {
      Alert("Expert Advisor cannot trade on a real account!");
      ExpertRemove();
      return(-2);
     }
//--- 检查是否可以在该账户交易(例如,使用只读密码时不能交易)
   if(!AccountInfoInteger(ACCOUNT_TRADE_ALLOWED))
     {
      Alert("Trading on this account is disabled");
      ExpertRemove();
      return(-3);
     }
//--- 节省启动EA交易的时间来接收交易历史记录
   history_start=TimeCurrent();
//---
   CreateBuySellButtons();
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| 专家去初始化函数                                                   |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- 删除所有图形对象
   ObjectDelete(0,"Buy");
   ObjectDelete(0,"Sell");
//---
  }
//+------------------------------------------------------------------+
//| TradeTransaction 函数                                            |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
                        const MqlTradeRequest &request,
                        const MqlTradeResult &result)
  {
//--- 标题命名在交易事件处理程序函数之后 
   Print("=> ",__FUNCTION__," at ",TimeToString(TimeCurrent(),TIME_SECONDS));
//--- 接收事务类型作为枚举值 
   ENUM_TRADE_TRANSACTION_TYPE type=trans.type;
//--- 如果事务是请求处理的结果
   if(type==TRADE_TRANSACTION_REQUEST)
     {
      //--- 显示事务名称
      Print(EnumToString(type));
      //--- 然后显示已处理请求的字符串描述
      Print("------------RequestDescription\r\n",
            RequestDescription(request,DescriptionModeFull));
      //--- 并显示请求结果的描述
      Print("------------ ResultDescription\r\n",
            TradeResultDescription(result,DescriptionModeFull));
     }
   else // 显示另一类型事务的完整描述
     {
      Print("------------ TransactionDescription\r\n",
            TransactionDescription(trans,DescriptionModeFull));
     }
//---     
  }
//+------------------------------------------------------------------+
//| 交易函数                                                          |
//+------------------------------------------------------------------+
void OnTrade()
  {
//--- 存储交易账户状态的静态成员
   static int prev_positions=0,prev_orders=0,prev_deals=0,prev_history_orders=0;
//--- 请求交易历史记录
   bool update=HistorySelect(history_start,TimeCurrent());
   PrintFormat("HistorySelect(%s , %s) = %s",
               TimeToString(history_start),TimeToString(TimeCurrent()),(string)update);
//--- 标题命名在交易事件处理程序函数之后
   Print("=> ",__FUNCTION__," at ",TimeToString(TimeCurrent(),TIME_SECONDS));
//--- 显示处理程序名称和处理时期订单数量
   int curr_positions=PositionsTotal();
   int curr_orders=OrdersTotal();
   int curr_deals=HistoryOrdersTotal();
   int curr_history_orders=HistoryDealsTotal();
//--- 用括号显示订单数量,持仓,成交,以及改变 
   PrintFormat("PositionsTotal() = %d (%+d)",
               curr_positions,(curr_positions-prev_positions));
   PrintFormat("OrdersTotal() = %d (%+d)",
               curr_orders,curr_orders-prev_orders);
   PrintFormat("HistoryOrdersTotal() = %d (%+d)",
               curr_deals,curr_deals-prev_deals);
   PrintFormat("HistoryDealsTotal() = %d (%+d)",
               curr_history_orders,curr_history_orders-prev_history_orders);
//--- 插入字符串断点,更便于查看日志
   Print("");
//--- 保存账户状态
   prev_positions=curr_positions;
   prev_orders=curr_orders;
   prev_deals=curr_deals;
   prev_history_orders=curr_history_orders;
//---
  }
//+------------------------------------------------------------------+
//| ChartEvent 函数                                                  |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//--- 处理 CHARTEVENT_CLICK 事件 ("点击图表")
   if(id==CHARTEVENT_OBJECT_CLICK)
     {
      Print("=> ",__FUNCTION__,": sparam = ",sparam);
      //--- 成交的最小交易量
      double volume_min=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
      //--- 如果按下"买入"按钮,则买入
      if(sparam=="Buy")
        {
         PrintFormat("Buy %s %G lot",_Symbol,volume_min);
         BuyAsync(volume_min);
         //--- 不按下该按钮
         ObjectSetInteger(0,"Buy",OBJPROP_STATE,false);
        }
      //--- 如果按下"卖出"按钮,则卖出
      if(sparam=="Sell")
        {
         PrintFormat("Sell %s %G lot",_Symbol,volume_min);
         SellAsync(volume_min);
         //--- 不按下该按钮
         ObjectSetInteger(0,"Sell",OBJPROP_STATE,false);
        }
      ChartRedraw();
     }
//---         
  }
//+------------------------------------------------------------------+
//| 返回交易事务的文本描述                                              |
//+------------------------------------------------------------------+
string TransactionDescription(const MqlTradeTransaction &trans,
                              const bool detailed=true)
  {
//--- 准备从函数返回的字符串
   string desc=EnumToString(trans.type)+"\r\n";
//--- 在详细模式添加所有可能的数据
   if(detailed)
     {
      desc+="Symbol: "+trans.symbol+"\r\n";
      desc+="Deal ticket: "+(string)trans.deal+"\r\n";
      desc+="Deal type: "+EnumToString(trans.deal_type)+"\r\n";
      desc+="Order ticket: "+(string)trans.order+"\r\n";
      desc+="Order type: "+EnumToString(trans.order_type)+"\r\n";
      desc+="Order state: "+EnumToString(trans.order_state)+"\r\n";
      desc+="Order time type: "+EnumToString(trans.time_type)+"\r\n";
      desc+="Order expiration: "+TimeToString(trans.time_expiration)+"\r\n";
      desc+="Price: "+StringFormat("%G",trans.price)+"\r\n";
      desc+="Price trigger: "+StringFormat("%G",trans.price_trigger)+"\r\n";
      desc+="Stop Loss: "+StringFormat("%G",trans.price_sl)+"\r\n";
      desc+="Take Profit: "+StringFormat("%G",trans.price_tp)+"\r\n";
      desc+="Volume: "+StringFormat("%G",trans.volume)+"\r\n";
     }
//--- 返回接收的字符串
   return desc;
  }
//+------------------------------------------------------------------+
//| 返回交易请求的文本描述                                              |
//+------------------------------------------------------------------+
string RequestDescription(const MqlTradeRequest &request,
                          const bool detailed=true)
  {
//--- 准备从函数返回的字符串
   string desc=EnumToString(request.action)+"\r\n";
//--- 在详细模式添加所有可用的数据
   if(detailed)
     {
      desc+="Symbol: "+request.symbol+"\r\n";
      desc+="Magic Number: "+StringFormat("%d",request.magic)+"\r\n";
      desc+="Order ticket: "+(string)request.order+"\r\n";
      desc+="Order type: "+EnumToString(request.type)+"\r\n";
      desc+="Order filling: "+EnumToString(request.type_filling)+"\r\n";
      desc+="Order time type: "+EnumToString(request.type_time)+"\r\n";
      desc+="Order expiration: "+TimeToString(request.expiration)+"\r\n";
      desc+="Price: "+StringFormat("%G",request.price)+"\r\n";
      desc+="Deviation points: "+StringFormat("%G",request.deviation)+"\r\n";
      desc+="Stop Loss: "+StringFormat("%G",request.sl)+"\r\n";
      desc+="Take Profit: "+StringFormat("%G",request.tp)+"\r\n";
      desc+="Stop Limit: "+StringFormat("%G",request.stoplimit)+"\r\n";
      desc+="Volume: "+StringFormat("%G",request.volume)+"\r\n";
      desc+="Comment: "+request.comment+"\r\n";
     }
//--- 返回接收的字符串
   return desc;
  }
//+------------------------------------------------------------------+
//| 返回请求处理结果的文本描述                                           |
//+------------------------------------------------------------------+
string TradeResultDescription(const MqlTradeResult &result,
                              const bool detailed=true)
  {
//--- 准备从函数返回的字符串
   string desc="Retcode "+(string)result.retcode+"\r\n";
//--- 在详细模式添加所有可用的数据
   if(detailed)
     {
      desc+="Request ID: "+StringFormat("%d",result.request_id)+"\r\n";
      desc+="Order ticket: "+(string)result.order+"\r\n";
      desc+="Deal ticket: "+(string)result.deal+"\r\n";
      desc+="Volume: "+StringFormat("%G",result.volume)+"\r\n";
      desc+="Price: "+StringFormat("%G",result.price)+"\r\n";
      desc+="Ask: "+StringFormat("%G",result.ask)+"\r\n";
      desc+="Bid: "+StringFormat("%G",result.bid)+"\r\n";
      desc+="Comment: "+result.comment+"\r\n";
     }
//--- 返回接收的字符串
   return desc;
  }
//+------------------------------------------------------------------+
//| 为买入和卖出创建两个按钮                                            |
//+------------------------------------------------------------------+
void CreateBuySellButtons()
  {
//--- 检查名称为“买入”的对象
   if(ObjectFind(0,"Buy")>=0)
     {
      //--- 如果发现的对象不是按钮,请删除
      if(ObjectGetInteger(0,"Buy",OBJPROP_TYPE)!=OBJ_BUTTON)
         ObjectDelete(0,"Buy");
     }
   else
      ObjectCreate(0,"Buy",OBJ_BUTTON,0,0,0); // 创建“买入”按钮
//--- 配置“买入”按钮
   ObjectSetInteger(0,"Buy",OBJPROP_CORNER,CORNER_RIGHT_UPPER);
   ObjectSetInteger(0,"Buy",OBJPROP_XDISTANCE,100);
   ObjectSetInteger(0,"Buy",OBJPROP_YDISTANCE,50);
   ObjectSetInteger(0,"Buy",OBJPROP_XSIZE,70);
   ObjectSetInteger(0,"Buy",OBJPROP_YSIZE,30);
   ObjectSetString(0,"Buy",OBJPROP_TEXT,"Buy");
   ObjectSetInteger(0,"Buy",OBJPROP_COLOR,clrRed);
//--- 检查名称为“卖出”的对象
   if(ObjectFind(0,"Sell")>=0)
     {
      //--- 如果发现的对象不是按钮,请删除
      if(ObjectGetInteger(0,"Sell",OBJPROP_TYPE)!=OBJ_BUTTON)
         ObjectDelete(0,"Sell");
     }
   else
      ObjectCreate(0,"Sell",OBJ_BUTTON,0,0,0); // 创建“卖出”按钮
//--- 配置“卖出”按钮
   ObjectSetInteger(0,"Sell",OBJPROP_CORNER,CORNER_RIGHT_UPPER);
   ObjectSetInteger(0,"Sell",OBJPROP_XDISTANCE,100);
   ObjectSetInteger(0,"Sell",OBJPROP_YDISTANCE,100);
   ObjectSetInteger(0,"Sell",OBJPROP_XSIZE,70);
   ObjectSetInteger(0,"Sell",OBJPROP_YSIZE,30);
   ObjectSetString(0,"Sell",OBJPROP_TEXT,"Sell");
   ObjectSetInteger(0,"Sell",OBJPROP_COLOR,clrBlue);
//--- 执行强制更新图表,立即查看按钮
   ChartRedraw();
//---
  }
//+------------------------------------------------------------------+
//| 使用OrderSendAsync()异步函数进行买入                                |
//+------------------------------------------------------------------+
void BuyAsync(double volume)
  {
//--- 准备请求
   MqlTradeRequest req={};
   req.action      =TRADE_ACTION_DEAL;
   req.symbol      =_Symbol;
   req.magic       =MagicNumber;
   req.volume      =0.1;
   req.type        =ORDER_TYPE_BUY;
   req.price       =SymbolInfoDouble(req.symbol,SYMBOL_ASK);
   req.deviation   =10;
   req.comment     ="Buy using OrderSendAsync()";
   MqlTradeResult  res={};
   if(!OrderSendAsync(req,res))
     {
      Print(__FUNCTION__,": error ",GetLastError(),", retcode = ",res.retcode);
     }
//---
  }
//+------------------------------------------------------------------+
//| 使用OrderSendAsync()异步函数进行卖出                                |
//+------------------------------------------------------------------+
void SellAsync(double volume)
  {
//--- 准备请求
   MqlTradeRequest req={};
   req.action      =TRADE_ACTION_DEAL;
   req.symbol      =_Symbol;
   req.magic       =MagicNumber;
   req.volume      =0.1;
   req.type        =ORDER_TYPE_SELL;
   req.price       =SymbolInfoDouble(req.symbol,SYMBOL_BID);
   req.deviation   =10;
   req.comment     ="Sell using OrderSendAsync()";
   MqlTradeResult  res={};
   if(!OrderSendAsync(req,res))
     {
      Print(__FUNCTION__,": error ",GetLastError(),", retcode = ",res.retcode);
     }
//---
  }
//+------------------------------------------------------------------+

在“专家”日志显示消息的示例:

 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnChartEvent: sparam = Sell
 12:52:52   ExpertAdvisor (EURUSD,H1)   Sell EURUSD 0.01 lot
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTradeTransaction at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   TRADE_TRANSACTION_REQUEST
 12:52:52   ExpertAdvisor (EURUSD,H1)   ------------RequestDescription
 12:52:52   ExpertAdvisor (EURUSD,H1)   TRADE_ACTION_DEAL
 12:52:52   ExpertAdvisor (EURUSD,H1)   Symbol: EURUSD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Magic Number: 1234567
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order ticket: 16361998
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order type: ORDER_TYPE_SELL
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order filling: ORDER_FILLING_FOK
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order time type: ORDER_TIME_GTC
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order expiration: 1970.01.01 00:00
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deviation points: 10
 12:52:52   ExpertAdvisor (EURUSD,H1)   Stop Loss: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Take Profit: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Stop Limit: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Volume: 0.1
 12:52:52   ExpertAdvisor (EURUSD,H1)   Comment: Sell using OrderSendAsync()
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   ------------ ResultDescription
 12:52:52   ExpertAdvisor (EURUSD,H1)   Retcode 10009
 12:52:52   ExpertAdvisor (EURUSD,H1)   Request ID: 2
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order ticket: 16361998
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal ticket: 15048668
 12:52:52   ExpertAdvisor (EURUSD,H1)   Volume: 0.1
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Ask: 1.29319
 12:52:52   ExpertAdvisor (EURUSD,H1)   Bid: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Comment
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistorySelect( 09:34 , 09:52) = true
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTrade at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   PositionsTotal() = 1 (+1)
 12:52:52   ExpertAdvisor (EURUSD,H1)   OrdersTotal() = 0 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryOrdersTotal() = 2 (+2)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryDealsTotal() = 2 (+2)
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTradeTransaction at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   ------------ TransactionDescription
 12:52:52   ExpertAdvisor (EURUSD,H1)   TRADE_TRANSACTION_ORDER_ADD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Symbol: EURUSD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal ticket: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal type: DEAL_TYPE_BUY
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order ticket: 16361998
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order type: ORDER_TYPE_SELL
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order state: ORDER_STATE_STARTED
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order time type: ORDER_TIME_GTC
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order expiration: 1970.01.01 00:00
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price trigger: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Stop Loss: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Take Profit: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Volume: 0.1
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTradeTransaction at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   ------------ TransactionDescription
 12:52:52   ExpertAdvisor (EURUSD,H1)   TRADE_TRANSACTION_ORDER_DELETE
 12:52:52   ExpertAdvisor (EURUSD,H1)   Symbol: EURUSD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal ticket: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal type: DEAL_TYPE_BUY
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order ticket: 16361998
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order type: ORDER_TYPE_SELL
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order state: ORDER_STATE_STARTED
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order time type: ORDER_TIME_GTC
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order expiration: 1970.01.01 00:00
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price trigger: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Stop Loss: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Take Profit: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Volume: 0.1
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistorySelect( 09:34 , 09:52) = true
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTrade at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   PositionsTotal() = 1 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   OrdersTotal() = 0 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryOrdersTotal() = 2 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryDealsTotal() = 2 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTradeTransaction at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   ------------ TransactionDescription
 12:52:52   ExpertAdvisor (EURUSD,H1)   TRADE_TRANSACTION_HISTORY_ADD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Symbol: EURUSD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal ticket: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal type: DEAL_TYPE_BUY
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order ticket: 16361998
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order type: ORDER_TYPE_SELL
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order state: ORDER_STATE_FILLED
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order time type: ORDER_TIME_GTC
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order expiration: 1970.01.01 00:00
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price trigger: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Stop Loss: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Take Profit: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Volume: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistorySelect( 09:34 , 09:52) = true
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTrade at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   PositionsTotal() = 1 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   OrdersTotal() = 0 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryOrdersTotal() = 2 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryDealsTotal() = 2 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTradeTransaction at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   ------------ TransactionDescription
 12:52:52   ExpertAdvisor (EURUSD,H1)   TRADE_TRANSACTION_DEAL_ADD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Symbol: EURUSD
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal ticket: 15048668
 12:52:52   ExpertAdvisor (EURUSD,H1)   Deal type: DEAL_TYPE_SELL
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order ticket: 16361998
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order type: ORDER_TYPE_BUY
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order state: ORDER_STATE_STARTED
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order time type: ORDER_TIME_GTC
 12:52:52   ExpertAdvisor (EURUSD,H1)   Order expiration: 1970.01.01 00:00
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price: 1.29313
 12:52:52   ExpertAdvisor (EURUSD,H1)   Price trigger: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Stop Loss: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Take Profit: 0
 12:52:52   ExpertAdvisor (EURUSD,H1)   Volume: 0.1
 12:52:52   ExpertAdvisor (EURUSD,H1)   
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistorySelect( 09:34 , 09:52) = true
 12:52:52   ExpertAdvisor (EURUSD,H1)   => OnTrade at 09:52:53
 12:52:52   ExpertAdvisor (EURUSD,H1)   PositionsTotal() = 1 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   OrdersTotal() = 0 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryOrdersTotal() = 2 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)   HistoryDealsTotal() = 2 (+0)
 12:52:52   ExpertAdvisor (EURUSD,H1)