DislikedYes I should not have used NewStop for newstop, but you are passing the value from one to the other. But in the first line: void _BreakEvenTrade (double newstop=0) { // newstop DEFAULT VALUE IS 0 Doesn't this set newstop to 0? If so, newstop is never > 0. if(newstop != OrderStopLoss() && newstop>0 ) // HERE newstop IS 3.5 PIP POINTS. However, either way, if you do set newstop to be 3.5, then you are passing the value 3.5 to the next function, NOT Entry price +/- 3.5 pips. So the next function will attempt to set SL to 3.5 for Buy and fail for Sell,...Ignored
Inserted Code
void start() { .... if (OrderStopLoss()>0 && BreakEven) BreakEvenTrade(); .... } void BreakEvenTrade() { double NewStop = -1; if(OrderType() == OP_BUY) { // is Buy Order in Profit NewStop = OrderOpenPrice()+(BreakEvenPips*Point); // stop is OrderPrice + BE if(Bid>OrderOpenPrice() && Bid>NewStop) _BreakEvenTrade(NewStop); } if(OrderType() == OP_SELL) { // is Sell Order in Profit NewStop = OrderOpenPrice()-(BreakEvenPips*Point); // stop is OrderPrice - BE if(Ask<OrderOpenPrice() && Ask<NewStop) _BreakEvenTrade(NewStop); } return; } void _BreakEvenTrade (double newstop=0) { if(newstop != OrderStopLoss() && newstop>0 ) { if( _ModifyStopLoss(newstop)==1) Print("WAKAR_WB Modified Stop Loss to BreakEven"); } return; }