该函数统计持仓订单中空单数量,过滤条件:货币、订单识别码、订单类型。可以自行修改过滤条件。
- int CountShorts(string a_symbol_0, int a_magic_8) {
- int l_count_12 = 0;
- for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) {
- OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES);
- if (OrderSymbol() == a_symbol_0) {
- if (OrderMagicNumber() == a_magic_8)
- if (OrderType() == OP_SELL) l_count_12++;
- }
- }
- return (l_count_12);
- }
|