How can retrieve multiple ticket numbers

Back to topics list To post a new topic, please log in or register
avatar
63
Neal_Van 2016.05.18 06:42
 

Having trouble understanding how to get ticket numbers of existing trades. Any suggestions?

Thank you...  

avatar
Moderator
3418
GumRai 2016.05.18 07:43 #
 
Select the order and store OrderTicket() in variables or an array
avatar
63
Neal_Van 2016.05.18 07:56 #
 
GumRai:
Select the order and store OrderTicket() in variables or an array

I want the EA to select the order automatically. How do I get the ticket numbers? I know how to do one ticket number but I don't know how to do all the ticket numbers.

Is there a way?

Thank you.   

avatar
Moderator
3418
GumRai 2016.05.18 08:01 #
 
Loop through all the orders and store the ticket numbers in an array.
avatar
1215
FMIC 2016.05.18 11:13 #
 
// Code Example to get Magic Numbers of All Open Orders into an array

int
   intOrdersMagicNumber[],
   intOrdersTotal = OrdersTotal();

if( ArrayResize( intOrdersMagicNumber, intOrdersTotal ) == intOrdersTotal )
{
   for( int i = intOrdersTotal - 1; i >= 0; i-- ) // Making it a habit of counting down with OrdersTotal()
   {
      if( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) )
         intOrdersMagicNumber[ i ] = OrderMagicNumber();
      else
         intOrdersMagicNumber[ i ] = EMPTY;
   }
}

 

Coder's are Engineers and like all Engineers you have to do your Research (reading documentation, tutorials and looking at other's code of which there are many examples in the Code Base section).

Then after the Research, comes the Creativity and Experimentation (taking what you learn and trying to applying it).

So, before posting a question on the Forum, try to first get basic understanding and experimenting with what you learn, so that when you do post here, you have your own coding attempt as a starting point.

Back to topics list  

To add comments, please log in or register