如何修改多单止损

楼主  收藏   举报   帖子创建时间:  2019-05-05 14:37 回复:0 关注量:778
该函数演示如何修改多单止损。

  1. for(int l_pos_76 = OrdersTotal() - 1; l_pos_76 >= 0; l_pos_76--)
  2. {
  3. OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES);
  4. if(OrderType()<=OP_SELL && // check for opened position
  5. OrderSymbol()==Symbol()) // check for symbol
  6. {
  7. if(OrderType()==OP_BUY) // long position is opened
  8. {
  9. // should it be closed?
  10. // check for trailing stop
  11. {
  12. OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-200*Point,0,0,Green);
  13. return(0);}
  14. }
  15. }
  16. }
打赏