获取某品种多单或空单的订单数量
- int CalculateCurrentOrders(string symbol)
- {
- int buys=0,sells=0;
- //---
- for(int i=0;i<OrdersTotal();i++)
- {
- if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
- if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
- {
- if(OrderType()==OP_BUY) buys++;
- if(OrderType()==OP_SELL) sells++;
- }
- }
- //--- return orders volume
- if(buys>0) return(buys);
- else return(-sells);
- }
复制代码
|