move stop to B.E.

 

hi, i have changed this MoveStopOnce so that it works off the stochastics crossing below 50 (sellorder) above 50 (buyorder), not sure if its coded correctly.

it seems to work when the trade is in profit but i want to add to it so that it closes the openorder when the trade is < openprice.

//MoveOnce
if(MoveStopOnce) {
if((StochMain > StochSignal) && StochMain > 50) {
if(OrderStopLoss() > OrderOpenPrice() && Ask < OrderOpenPrice()) {
OrderModify(OrderTicket(),OrderOpenPrice(), OrderOpenPrice() - Point * MoveStopTo, OrderTakeProfit(), 0, Red);
if (!EachTickMode) BarCount = Bars;
BarsCount = Bars;
continue;

cheers