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.
// 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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Having trouble understanding how to get ticket numbers of existing trades. Any suggestions?
Thank you...