老周 发表于 2017-3-20 11:19:39

指定货币及订单识别码的持仓单数量统计


该函数获取指定货币及订单识别码的持仓单总数量。可以自行设定统计条件。

int CountAll(string a_symbol_0, int a_magic_8, int a_magic_12, int a_magic_16, bool ai_20, int
ai_24) {
int l_count_28 = 0;
for (int l_pos_32 = OrdersTotal() - 1; l_pos_32 >= 0; l_pos_32--) {
OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES);
if (!ai_24 || OrderSymbol() == a_symbol_0) {
if (!ai_20) l_count_28++;
else {
if (a_magic_16 != 0) {
if (a_magic_16 == OrderMagicNumber()) l_count_28++;
else
if (OrderMagicNumber() == a_magic_8 || OrderMagicNumber() ==
a_magic_12) l_count_28++;
}
}
}
}
return (l_count_28);
}

页: [1]
查看完整版本: 指定货币及订单识别码的持仓单数量统计