how to check profit and modify stop

 

i want to check for profit everytime the ea make a trade and when it does make 50 pips profit the system will set the stoploss to +20 pips that way i can keep my profit, any help would be nice

 

Something like

if (OrderSelect(...))
{
   if (Bid >= OrderOpenPrice() + 50*Point) OrderModify(...)
}
 
i knew this method but i want to change the stop whenever the profit grows so i can keep more profit then loss, like when it goes up 50 pips then it change stop to +20 when goes up to 100 pips it change stop to +50 etc.
 
if (OrderTakeProfit() - OrderStoploss() > 50*Point) ...
Reason: