It is depand on whih stop loss is typed first in code and whih one is second.
If I put stop loss for long positon as first and stop loss for short position as second, only the second one is moved to breakeven. The first one is not moved.
In the sample below only the stop loss for long position is moved to breakeven.
Could you help me to find where the mistake is and what should I change??
Czarek
/// <summary>
/// Called on each incoming execution
/// </summary>
protected override void OnExecution(IExecution execution)
{
/* We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
which ensures your strategy has received the execution which is used for internal signal tracking. */
if (entryOrder != null && entryOrder.Token == execution.Order.Token)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
// Stop-Loss order 4 ticks below our entry price
stopOrder = ExitShortStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice + stop * TickSize, "MyStopShort1", "MyEntryShort1");
// Target order 8 ticks above our entry price
targetOrder = ExitShortLimit(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - limit * TickSize, "MyTargetShort1", "MyEntryShort1");
// Stop-Loss order 4 ticks below our entry price
stopOrder = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - stop * TickSize, "MyStopLong1", "MyEntryLong1");
// Target order 8 ticks above our entry price
targetOrder = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AvgFillPrice + limit * TickSize, "MyTargetLong1", "MyEntryLong1");
{
entryOrder = null;
}
}
}

Comment