Stop loss modify not working for sells

 

Hi, I've been woring on an ea with a SL function that is set after a period of time has elapsed AND an amount of pips profit it cleared.. it works for OrderModify OP=BUY but not for OP=SELL, I think I'm just missing something simple but cant seem to grasp what it is.. anyhow, here's the code;

 

else if((Bid - OrderOpenPrice())> (BESLPROFIT*Point) && (TimeCurrent()- OrderOpenTime()) > SLDuration)
                  {  
                   if (OrderModify(OrderTicket(),OrderOpenPrice(),(OrderOpenPrice()+(BESL*Point)),OrderTakeProfit(),0,Green)== true)
                     {
                     OMNB5--;
                     continue;
                     }
                   else
                     {
                     Alert ("Problem whilst moving SL to BE");
                     return(0);
                     }
                  }  
                 else
                {
                 Alert ("Insufficent time elapsed to move SL B5");
                 continue;
               }


// above is the order modify for BUY

// below is for SELL 




if ((Ask - OrderOpenPrice())> (BESLPROFIT*Point) && (TimeCurrent()- OrderOpenTime()) > SLDuration)
                 {
                   if (OrderModify(OrderTicket(),OrderOpenPrice(),(OrderOpenPrice()-(BESL*Point)),OrderTakeProfit(),0,Blue)== true)
                    {
                     OMNS5--;
                     continue;
                    }
                   else
                    {
                     Alert ("Problem whilst moving SL to BE");
                     return(0);
                    }
                 }  
                 else
                  {
                   Alert ("Insufficent time elapsed to move SL");
                   continue;
                  }

 
xanderhinds: . it works for OrderModify OP=BUY but not for OP=SELL, I think I'm just missing something simple but cant seem to grasp what it is..

 

if ((Ask - OrderOpenPrice())> (BESLPROFIT*Point) && (TimeCurrent()- OrderOpenTime()) > SLDuration)
If your sell order is in profit, the Ask will be below the OOP.
 
whroeder1:
If your sell order is in profit, the Ask will be below the OOP.

Thanks Whroeder1, you're a legend. 

Reason: