number of opened trades

To add comments, please log in or register
Forex Trader
114347
Forex Trader  
This function should return number of opened trades per symbol. It's ok except on the last pair on the chart. IF there (on the last pair) are no opened trades this function always returns -1.
Here is the function:

int subTotalTrade()
{
int
cnt,
total = 0;

for(cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol() )total++;
}
return(total);
}
To add comments, please log in or register