该函数获取最近平仓订单的订单编号。过滤条件:订单识别码、订单类型。
- int LastBuyStop() {
- for (int l_pos_0 = OrdersHistoryTotal() - 1; l_pos_0 >= 0; l_pos_0--) {
- if
- (OrderSelect(l_pos_0,
- SELECT_BY_POS,
- MODE_HISTORY)
- &&
- OrderMagicNumber() == -2101841039 && OrderType() == OP_BUY) {
- if (OrderTicket() == g_ticket_172) return (-1);
- if (OrderTicket() > g_ticket_172) {
- g_ticket_172 = OrderTicket();
- return (g_ticket_172);
- }
- }
- }
- return (-1);
- }
|