Download MetaTrader 5

Is There Any Way to Get The Ticket No. of Terminal Trading Tab Through A Single Click?

To add comments, please log in or register
Publish your article and get a reward!
Gatesby
41
Gatesby 2016.10.29 13:14 

Hi, Gurus:

Does anybody know how to get a specific Order's Ticket No. through one click in order list  of the terminal trading tab?

Current situations:

1. Double click one of the order list in trading tab & pop out a dialog window (Yes! The Interface for the operations of  deleting / modifying / closing a certain order in the order list of trading tab)

    But I didn't have any idea how to get the exact order's ticket No. which is  just shows on the window's title as we've familiar with it.

    I've got through the MQL4 manual as RTFM but didn't get any useful info.

2. Without any mouse action in trading tab just runs the for loop function through the order's array (Yes! Just as we've known as an EA/Script/Indicator did) in the order list.

    For loop function visit every single order in the order's array  by a counter & OrdersTotal() which need take time as an indirect way to get an order's all info in details.

    

bool ForLoopFunctionForExample()
{
   int cnt;
   int total = OrdersTotal();

   for(cnt=total-1;cnt>=0;cnt--)
   {
     if(!OrderSelect(cnt, SELECT_BY_POS)) continue; 
        // or  
        if(!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) continue;
    ....
   }
}

 

Any of your hints / examples / advice will be sincerely appreciated in advance!  Thanks!

   


    

Fernando Carreiro
2350
Fernando Carreiro 2016.10.30 01:59  

Sorry, but your query is not very clear, but here are some pointers:

  • Visually, on MetaTrader, the Order's ticket number is right there in the column called "Order" in the "Trade" or "Account History" tab. There is no mouse click involved - you just read the number of the display. There is not copy/paste function for the Order Ticket number.
  • Programmatically, in MQL4, you can access the ticket number via the OrderTicket() function, once you have selected an Order with the OrderSelect() function.
Gatesby
41
Gatesby 2016.11.01 03:43  

Thanks for your reply! 

 

The real purpose of my issue is "How to reverse specific order in the order list of Meta terminal Trading Tab " 

Just like when you open several orders of one symbol (in the same chart) and one of them have different direction from others (for example. Order 1 ... Order 3 are Short positions but Order 4 is Long position and Order 5 ... Order N are Short positions).

Due to the current MT4 Terminal only have simple right click menu in trading tab. 

MT4 Terminal Right Click Menu

Yes ! We have open / close / modify / delete order menu but NO Reverse a certain order menu in the mouse right click !

Once I got a ticket No.which is the unique identifier of a certain order, I can transfer it to my EA GUI then I can do whatever I want!

Fernando Carreiro
2350
Fernando Carreiro 2016.11.01 04:53  
Gatesby:

Thanks for your reply! 

The real purpose of my issue is "How to reverse specific order in the order list of Meta terminal Trading Tab " 

Just like when you open several orders of one symbol (in the same chart) and one of them have different direction from others (for example. Order 1 ... Order 3 are Short positions but Order 4 is Long position and Order 5 ... Order N are Short positions).

Due to the current MT4 Terminal only have simple right click menu in trading tab. 

Yes ! We have open / close / modify / delete order menu but NO Reverse a certain order menu in the mouse right click !

Once I got a ticket No.which is the unique identifier of a certain order, I can transfer it to my EA GUI then I can do whatever I want!

What do you mean by "Reverse a certain order"? There is no such thing as reversing an order (at least, not in the MetaTrader environment)!

If you mean a kind of Stop-and-Reverse or maybe something like a "Hedging" effect on the same symbol, then those are concepts specific to your trading strategy and has nothing to do with order management (i.e. open, modify, close or delete).

Your original request was for a Ticket number, for which I supplied some answers. If you want to apply a SAR or Hedging strategy, then you have to implement those either manually or via an EA that applies your trading strategy logic!

Gatesby
41
Gatesby 2016.11.01 07:47  

Yeah! There's no such function in current MT4 environment as we all know it.

 

It's a kind of Close & Reverse but not concern about "Hedging" strategy.    Holding one order still and reversing another one. In Chinese,  holding different direction orders on the same symbol is not 'Hedge' but 'lock'. 

It's more about money management than trading strategy. 

MT4 Right Click Menu 2

Gatesby
41
Gatesby 2016.11.01 08:07  

   The Demo Account snapshot shows what I really wanted.

    MT4 Right Click Menu 3

   

To add comments, please log in or register