I have an issue: when the stop loss moves to breakeven using ChangeOrder, with the main condition Close[0] <= priceMove, everything works fine... until the price closes above priceMove. At that point, the stop loss reverts to its original position (stopLoss). What can I do to ensure the stop loss stays at breakevenPrice, even if the price moves back above? I just need it to move once when the price crosses below priceMove.
Is this normal happen with ChangeOrder? I am using calculate onbarclose, for that reason I guess "jump" the condition, any idea how to fix it meanwhile I use onbarclose? its necessary to the strategy
stopOrder = ExitShortStopMarket(0, true, Convert.ToInt32(QTY1), stopLoss, "SL", "ShortEntry1");
double breakevenPrice = Position.AveragePrice - (10 / tickValue) * TickSize;
double priceMove = Position.AveragePrice - (50 / tickValue) * TickSize;
if (stopOrder != null
&& stopOrder.StopPrice > Position.AveragePrice
&& Close[0] <= priceMove)
{
ChangeOrder(stopOrder, Convert.ToInt32(1), 0, breakevenPrice
);
}

Comment