
Originally Posted by
przem81621
I,m suppose that is simply problem.
i want to know what is number of each trade, but no ticket.
it should be counter of trades.
ex.
turn on ea - countersell,counterbuy=0
first sell trade was open - countersell=1
second sell trade countersell=2
first buy counterbuy=1
........
turn of ea
how to code this?
Hi przem81621,
Here is a count orders function :
Code:
int CountOrders(int Type)
{
int CountOrd;
CountOrd=0;
for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol())
{
if((OrderType()==Type&&(OrderMagicNumber()==Magic)||Magic==0))CountOrd++;
}
}
return(CountOrd);
}
Then in the code :
Code:
CountOrders(OP_BUY);
CountOrders(OP_SELL);