Help with incremental Trail !!!

 

Hi, 

I want to create a function to move stop losses, But I constantly get OrderModify Error 1. Can you help me?

void increment()
{
int incB=0,incS=0,tkt[];
double stoploss[];
ArrayResize(tkt,OrdersTotal());
ArrayResize(stoploss,OrdersTotal());
bool incrementBuy=false,incrementSell=false;
if(incremental_trail==true )
 {
 for(int i=0;i<OrdersTotal();i++ )
  {
  if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
  if(OrderMagicNumber()==magic)
  tkt[i]=OrderTicket();
  stoploss[i]=OrderStopLoss();
   {
   if(OrderType()==OP_BUY) 
    {
incB++;
if(incB>1 && modified1B==false)
 {
   Print("tkt 1 : ",tkt[i] ,"tkt -1 : ",tkt[i-1],"stoploss 1 : ",stoploss[i-1],"stoploss 2 : ",stoploss[i]);
  bool modify = OrderModify(tkt[i-1],OrderOpenPrice(),NormalizeDouble(stoploss[i],Digits),OrderTakeProfit(),0,clrYellow);
  if(modify==true)Print("Incremental trail !!");modified1B=true;return;
 }
 else if (incB<2) 
 {
 modified1B=false;
 break;
 }
 //else return;
    }
  if(OrderType()==OP_SELL)
    {
incS++;
if(incS>1 && modified1S==false)
 {
      Print("tkt 1 : ",tkt[i] ,"tkt -1 : ",tkt[i-1],"stoploss 1 : ",stoploss[i-1],"stoploss 2 : ",stoploss[i]);
   bool modify = OrderModify(tkt[i-1],OrderOpenPrice(),NormalizeDouble(stoploss[i],Digits),OrderTakeProfit(),0,clrYellow);
  if(modify==true)Print("Incremental trail !!");modified1S=true; return;
 }
  else if (incS<2) {
  modified1S=false;
  break;
  }
 // else return;
    }
   }
  }
 }
}
 
ERR_NO_RESULT
You Server
Change the SL to XIt is at X!
Change the SL to X It is at X!
Change the SL to XYou are insane
Use the debugger or print out your variables, including _LastError and find out why.
Reason: