how to select all the open buy orders and open sell orders from a bunch of mixed up of orders in EA?
How many variations do you want ?
Try this: http://crum.be/select
BuildOpenBuyArray(); OpenBuyCount = ArraySize(OpenBuyTickets); ArraySort(OpenBuyTickets, WHOLE_ARRAY); for (i = 0; i < TicketCount; i++) { OrderSelect(OpenBuyTickets[i],SELECT_BY_TICKET); Print("OrderTicket()); .......... }
The above code snippet will call the function below (place at the end of your EA) ito collect all buy tickets in an array called OpenBuyTickets. It will then print all the open tickets in ascending order and/or what ever you put in the .... bit.
void BuildOpenBuyArray() { OpenBuyCount = 0; ArrayResize(OpenBuyTickets,0); for (i = 0; i < OrdersTotal(); i++) { ArrayResize(OpenBuyTickets, OpenBuyCount + 1); OrderSelect(i, SELECT_BY_POS); if (OrderType() != 0) continue; OpenBuyTickets[OpenBuyCount] = OrderTicket(); OpenBuyCount = OpenBuyCount + 1; } }
hi there....i need some help in EA......can someone give the code snippet to select all the open buy orders from a bunch of mixed open orders??.....thanks in advance!!
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. && OrderType() == OP_BUY ){ :
hi there....i need some help in EA......can someone give the code snippet to select all the open buy orders from a bunch of mixed open orders??.....thanks in advance!!