请教一个判断持仓时间来修改止盈位的代码

 

我写了这个代码但是似乎不管用,大神帮忙看看,谢谢!

   if (OrdersTotal()>0)
    {
     int i;
     for(i=0;i<3;i++)
     {
     
     if(OrderSelect(i,SELECT_BY_TICKET)==TRUE)
       {
        if(TimeCurrent()-OrderOpenTime()>=持仓小时后不亏钱平仓*3600)
          {
            if(TimeCurrent()-OrderOpenTime()<=持仓小时后亏钱平仓*3600)
              {
                if(OrderType()==OP_BUY)
                   {
                   
                    check=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),
                                                   NormalizeDouble(OrderOpenPrice()+0.0001,Digits),0);
                   }
                else
                   
                    check=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),
                                                   NormalizeDouble(OrderOpenPrice()-0.0001,Digits),0);
              }
            else
              {
                if(OrderType()==OP_BUY)
                   {
                    check=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),
                                                   NormalizeDouble(OrderOpenPrice()-MathAbs(OrderOpenPrice()-OrderStopLoss())*止盈倍率*2,Digits),0);
                   }
                else
                   
                    check=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),
                                                   NormalizeDouble(OrderOpenPrice()+MathAbs(OrderOpenPrice()-OrderStopLoss())*止盈倍率*2,Digits),0);
              }
          }
        
       }
     else 
       break;
     
      }
     }
 
chnp:

我写了这个代码但是似乎不管用,大神帮忙看看,谢谢!

if( TimeCurrent()-OrderOpenTime()>=持仓小时后不亏钱平仓* 3600)
          {
             if( TimeCurrent()-OrderOpenTime()<=持仓小时后亏钱平仓* 3600)
          }

这句话是冲突的

原因: