change the stop loss

 
Hi, I'm having trouble creating a script that will change the stop loss of my orders. I keep getting error number 4109. Here is the part of the script that is giving me trouble.

for (i = 0; i < ordersTotal; i++)
         {
            //select the order 
            if(OrderSelect(i,SELECT_BY_POS, MODE_TRADES))
            {
               //get the right order 
               if(OrderSymbol() ==  Symbol())
               {
                  //remember the old stop loss.                  
                  originalSP = OrderStopLoss();
                  //update the stop loss
                  if(OrderType() == OP_BUY)
                  {
                     newSP = Bid-(Point * 30);
                     if(originalSP > newSP)
                     {
                        newSP = originalSP;                        
                     }
                  }else if(OrderType() == OP_SELL)
                  {
                     newSP = Bid+(Point * 30);
                     if(originalSP < newSP)
                     {
                        newSP = originalSP;
                     }
                  }
                  Print("new stop loss for ",Symbol(), " at ", newSP);
                  if(!OrderModify(OrderTicket(), OrderOpenPrice(),newSP, OrderTakeProfit(), 0, Green))
                  {
                     Print("OrderModify returned the error of ",GetLastError());
                  }
                  //exit the loop
                  break;                  
               }            
            }else{
               Print("OrderSelect returned the error of ",GetLastError());   
            }                      
         }
 
Check "Allow live trading" button
 
but I am not trading live yet.
 
actually that worked. thanks alot Slawa.
Reason: