How to get the ticket?

 

What is the most simple method to get the ticket number if I open trade as follow? Thanks.


#include  <Trade\Trade.mqh>
CTrade trade;

Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
   
trade.Buy(0.1,NULL,Ask,0,0,NULL);
 
mobaobao:

What is the most simple method to get the ticket number if I open trade as follow? Thanks.


Use ResultOrder

trade.ResultOrder()
Documentation on MQL5: Standard Library / Trade Classes / CTrade / ResultOrder
Documentation on MQL5: Standard Library / Trade Classes / CTrade / ResultOrder
  • www.mql5.com
ResultOrder - CTrade - Trade Classes - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
mobaobao:What is the most simple method to get the ticket number if I open trade as follow? Thanks.

Please don't normalise Bid, Ask or any other quote price returned by the system. It is already normalised!

Reason: