TrailingStop help

 

Could someone please take look at this code and tell me why it is moving the stoploss in both directions??? Could you also tell me how to correct this problem? I really appreciate your help!

if (Bid - OrderOpenPrice() <= Point * TrailingStop) continue;

if (OrderStopLoss >= Bid - Point * TrailingStop) continue;

RefreshRates();

OrderStopLoss = Bid - Point * TrailingStop;

if (stochastic_248 < 50.0 && macd_572 > macd_580) price_36 = OrderTakeProfit() + TrailingPips * Point;

OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss, OrderTakeProfit, 0, Blue);
return (0);

Or...

Could this be the problem???

if (StopLoss > 0.0) OrderStopLoss = Ask - StopLoss * Point;

 

if (Bid - OrderOpenPrice() > Point * TrailingStop&&OrderStopLoss() < Bid - Point * TrailingStop)

{

if (stochastic_248 < 50.0 && macd_572 > macd_580) price_36 = OrderTakeProfit() + TrailingPips * Point;

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, Blue);
return (0);

}

Reason: