评论

收藏

批量追踪止损

avatar colin.hong | 245 人阅读 | 0 人评论 | 2024-06-25

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+ 追踪止损
void move_sl()
  {


   int total=OrdersTotal();
   for(int i=0; i<total; i++)
     {
      if(OrderSelect(i, SELECT_BY_POS))
        {
         if(OrderSymbol()==Symbol()  && OrderMagicNumber()==识别码3)
           {
            if(OrderType()==OP_BUY)
              {
               if(NormalizeDouble(Bid-OrderOpenPrice(),Digits)>=追踪止损启动点数*Point)
                 {
                  if(OrderStopLoss()>OrderOpenPrice() && OrderStopLoss()<OrderClosePrice()-追踪止损点数*Point)
                    {
                     bool res22=OrderModify(OrderTicket(), OrderOpenPrice(), OrderClosePrice()-追踪止损点数*Point, OrderTakeProfit(), 0);
                    }
                 }
              }
            if(OrderType()==OP_SELL)
              {
               if(NormalizeDouble(OrderOpenPrice()-Ask,Digits)>=追踪止损启动点数*Point)
                 {
                  if((OrderStopLoss()==0 || OrderStopLoss()>OrderClosePrice()+追踪止损点数*Point) && OrderStopLoss()<OrderOpenPrice())  
                    {
                     bool res11=OrderModify(OrderTicket(), OrderOpenPrice(), OrderClosePrice()+追踪止损点数*Point, OrderTakeProfit(), 0);
                    }
                 }
              }
           }
        }
     }
     }

""
还没有人打赏,支持一下
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则