Code won't update a StopLoss

 

Hi all, 

I am working on a simple Stop->Breakeven function. Works fine if no SL is manually set, however, if I DO manually set an SL, like in the GUI by dragging the line off the entry to where I want the SL, the code does not modify the SL and I am struggling to figure out why. Here's my code: 


   if(useStopToBE && tradeHitBETrigger && !tradeAtBE && (!buyTradeIsTrailing && !sellTradeIsTrailing)){
      if (localDebug) Print ("PerformTradeManagement() - SLtoBE: Change SL for #" + ticket + " - " + PositionGetString(POSITION_SYMBOL) + " PNL: $" + PositionGetDouble(POSITION_PROFIT) + " - Type: " + strPositionType + ". New SL: " + PositionGetDouble(POSITION_PRICE_OPEN));
      
      if(!trade.PositionModify(ticket, PositionGetDouble(POSITION_PRICE_OPEN), 0))
         Print(__FILE__," ",__FUNCTION__,", ERROR: ","CTrade.PositionModifyTicket ",ticket);
      
      // If the price was moved to BE, exit the function, no more processing needed. 
      return; 
   }