Can anyone help with indicator based stops

 

I'm trying to program my stops so that if profit is greater than 30 (pips), we will have a stop equal to the 55 Period MA, if profit is greater than 60, we'll use a 21 MA, if profit is greater then 90 we'll use an 8 MA. The problem is when profit goes above 60 (so it reverts to the 21 MA) and then falls back below 60, the moving average falls back to the 55 period MA (which we don't want). The stop should hold at the 21 MA.

Once the price leaves the 55ma tier, it should not go back there. Can anyone help?

ma1 = iMA(NULL, 0, 8, 0, MODE_EMA, PRICE_CLOSE,0);
ma2 = iMA(NULL, 0, 21, 0, MODE_EMA, PRICE_CLOSE,0);
ma3 = iMA(NULL, 0, 55, 0, MODE_EMA, PRICE_CLOSE,0);

OOP30= OrderOpenPrice() + 30*Point;
OOP60= OrderOpenPrice() + 60*Point;
OOP90= OrderOpenPrice() + 90*Point;
OOP120= OrderOpenPrice() + 120*Point;

if(OrderType() == OP_BUY)
{
if( Ask > (OOP30) && Ask < (OOP60) && Ask > ma3)
{
OrderModify(OrderTicket(),OrderOpenPrice(),ma3, OrderTakeProfit(),0,Blue);
}

if( Ask > (OOP60) && Ask < (OOP90) && Ask > ma2)
{
OrderModify(OrderTicket(),OrderOpenPrice(),ma2, OrderTakeProfit(),0,Blue);
}

if( Ask > (OOP90) && Ask < (OOP120) && Ask > ma1)
{
OrderModify(OrderTicket(),OrderOpenPrice(),ma1, OrderTakeProfit(),0,Blue);
}

Reason: