该函数演示如何修改多单止损。
- for(int l_pos_76 = OrdersTotal() - 1; l_pos_76 >= 0; l_pos_76--)
- {
- OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES);
- if(OrderType()<=OP_SELL && // check for opened position
- OrderSymbol()==Symbol()) // check for symbol
- {
- if(OrderType()==OP_BUY) // long position is opened
- {
- // should it be closed?
- // check for trailing stop
- {
- OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-200*Point,0,0,Green);
- return(0);}
- }
- }
- }
|