Disliked{quote} Looks like we're on same boat. I did same thing, close and restart MT4, and it moved the SL. I had similar feeling yesterday, and a pair AUDUSD had gone much further, but came back and hit SL close to sell price. It maybe that, it needs restart often? Or cache needs to be cleared somehow? Started new explorer with a Oanda. PSAR and RSI combination - still looking to see where this goes.Ignored
if (OrderType()==OP_BUY && SetStopLossToBreakEvenPips != 0
&& OrderProfit() >= Wager * SetStopLossToBreakEvenPips * 10
&& BreakEvenCompleted == 0)
{
StopLossPrice = OrderOpenPrice() + Spread + PointValue;
res = OrderModify(OrderTicket(),OrderOpenPrice(),StopLossPrice, TakeWinPrice, 0, clrMaroon);
if (res > -1)
{
CurrProfitTarget = OrderProfit() + (Wager / Close[0] * 50);
BreakEvenCompleted = 1;
BreakEvenPrice = StopLossPrice;
}
}
if (OrderType()==OP_SELL && SetStopLossToBreakEvenPips != 0
&& OrderProfit() >= Wager * SetStopLossToBreakEvenPips * 10
&& BreakEvenCompleted == 0)
{
StopLossPrice = OrderOpenPrice() - Spread - PointValue;
res = OrderModify(OrderTicket(),OrderOpenPrice(),StopLossPrice, TakeWinPrice, 0, clrMaroon);
if (res > -1)
{
CurrProfitTarget = OrderProfit() + (Wager / Close[0] * 50);
BreakEvenCompleted = 1;
BreakEvenPrice = StopLossPrice;
}
}
translated it means -
If the order is a Buy trade (or Sell trade) and the Break Even pips are not zero and the profit is greater or equal to Lot Size * Break Even Pips * 10 and Break Even has not been previously set
Then the new Stop Loss price = Order Open Price + Spread + 1 point
Modify the current Order with the new Stop Loss price
If the order is completed then
Set the Profit Target to 5% extra, mark the Break Even transaction completed and set the Break Even Price (used for calculations in the future).
In the code, you can see that until the modification is actually made, the program will continue to attempt make the modification because BreakEvenCompleted will still be set to Zero.
Also If you look at the trade lists of the EA at the top of the page, you can see evidence of precisely this setting being respected by all the trades closed around the 1 pip profit area.