entryOrder and entryOrder2. I have a problem in the bold line of the OnExecution part.
The bold part should be linked to the second IOrder but apparently I do not know how to
link the entryOrder2 in those lines. It is making problem that sometimes IOrder which is the first order, is canceling the profit target. Can you tell me what should I add to bold lines in order to relate them to EntryOrder2.
if (entryOrder2 != null && entryOrder2 == execution.Order)
{
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
stopOrder2 = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice + initialStopDistance * TickSize, "MyStop2", "MyEntry2");
// Target order 8 ticks above our entry price
targetOrder2 = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AvgFillPrice + profit * TickSize, "MyTarget2", "MyEntry2");
Comment