I am using an Unmanaged approach in NinjaScript to create an OCO order. This process works and the Submit order code is pasted below in Code 1
***************** Code 1 *******************
longOrder = SubmitOrder(0, OrderAction.Buy, OrderType.StopLimit, 1, tickPrice +3 * TickSize, tickPrice +3 * TickSize, String.Format("Oil" + qty), "long limit entry");
***************** End of Code 1 *******************
In the Following OnExecution Event I then create a Stop Loss. This also works and I can see it trailing the market price on the chart - Notice the ocoid differs from the one associated with the current long order.
***************** Code 2 *******************
stopOrder = SubmitOrder(0, OrderAction.SellShort, OrderType.StopLimit, 1, tickPrice -1 * TickSize, tickPrice -1 * TickSize * TickSize, String.Format("OilStop" + qty), "Stop loss to protect long");
***************** End of Code 2 *******************
The thing though is that when the market prices reverses and hits my Stop loss, it simply goes past it leaving it unaffected. Why does it not get a fill and close the current "Long" position?
C

Comment