I'm trying to move my stop loss to break even in my EA with the following code:
The stop loss will move but the original take profit isn't being set. It modifies just the stop loss on the order and not the take profit. Any ideas would be greatly appreciated.
Inserted Code
//Move Stop Loss to Break Even if (OrderType()==OP_BUYSTOP) { if (bid >= OrderOpenPrice () + (SLToBreakEvenPercent*TakeProfit2) && OrderStopLoss()<OrderOpenPrice()) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,CLR_NONE); } } if (OrderType()==OP_SELLSTOP) { if (ask <= OrderOpenPrice() - (SLToBreakEvenPercent*TakeProfit2) && (OrderStopLoss()>OrderOpenPrice()|| OrderStopLoss()==0)) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,CLR_NONE); } }
The stop loss will move but the original take profit isn't being set. It modifies just the stop loss on the order and not the take profit. Any ideas would be greatly appreciated.