Having trouble understanding how to get ticket numbers of existing trades. Any suggestions?
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?
// Code Example to get Magic Numbers of All Open Orders into an array
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();
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.
To add comments, please log in or register