I only have one trade a time per symbol trading. I need to get the ticket number of that trade for an OrderClose based on a function. How do I get the ticket number of this order?
- Time Between Trades
- OrderClose function, Help!
- Current price from open order by ticket
MM
Something like this - OTTOMH :)
int ReturnFirstTicket(iMN int) { // Takes an input of MagicNumber int icnt, itotal, iTicket; itotal=OrdersTotal(); for(icnt=0;icnt<itotal;icnt++) { // order loop boundary OrderSelect(icnt, SELECT_BY_POS, MODE_TRADES); // check for opened position, symbol & MagicNumber if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==iMN) // Open orders for pair on chart and the right Magic Number { iTicket = OrderTicket(); break; } } // order loop boundary return(iTicket); }
Good Luck
-BB-
BarrowBoy:
MM
Something like this - OTTOMH :)
Good Luck
-BB-
Thanks for the help a while back BarrowBoy. I've got a new EA that trades more than one order a time. I need to pull up the last order that was placed. How would I do that?
Just create a loop, descending the order pool starting at OrdersTotal()-1 and ending at 0 selecting each order by position in the pool using OrderSelect().
Check the OrderOpenTime() for each order to determine which is the most recent.
CB
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register