I wondered if anybody had an idea why I exitLongMIT orders are being cancelled?
Scenario and log below:
- limit order is placed
- limit order is entered
- long exits are placed
- first partial LE25(18495.25)(10-13-0) is hit
- LE75, LE100, LE125 orders are cancelled because: "Cancelled pending exit order, since associated position is closed"
All order have unique ID's.
Execution:execution='c3bee1d43bcb454f8b5774fd02d92 96a' instrument='MNQ JUN25' account='Playback101' exchange=Default price=18475.5 quantity=2 marketPosition=Long orderId='82ba51fd15e64a8c8bff2011aa96710f' time='2025-04-11 10:13:12' sod=False statementDate='2025-04-11'
Execution.order
rderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=PartFilled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=2 averageFillPrice=18475.5 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'EntryOrder
rderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=PartFilled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=2 averageFillPrice=18475.5 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'Time 11/04/2025 10:13:00: execution happened, still LONG, adjust stoploss contracts
Time 11/04/2025 10:13:00: adjust LONG stop contracs to 2
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=2 LimitPrice=0 StopPrice=18413,25 SignalName='Stoploss' FromEntrySignal='Friday:10:14-36'
Time 11/04/2025 10:13:00:
Execution:execution='3f348517c43041d695abf4111259f 7b0' instrument='MNQ JUN25' account='Playback101' exchange=Default price=18475.75 quantity=198 marketPosition=Long orderId='82ba51fd15e64a8c8bff2011aa96710f' time='2025-04-11 10:13:12' sod=False statementDate='2025-04-11'
Execution.order
rderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=Filled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=200 averageFillPrice=18475.7475 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'EntryOrder
rderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=Filled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=200 averageFillPrice=18475.7475 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'Time: 11/04/2025 10:13:00 - CancellAllOrders: resetEntryAndStop = False
Time: 11/04/2025 10:13:00 - current order list:
orderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=Filled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=200 averageFillPrice=18475.7475 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'
orderId='f51c79723c1240ab9fcb4f7fa285d515' account='Playback101' name='Stoploss' orderState=Accepted instrument='MNQ JUN25' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=18413.25 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=757 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'
Time 11/04/2025 10:13:00 : Placing exit orders for long position
Time 11/04/2025 10:13:00: adjust LONG stop contracs to 200
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=200 LimitPrice=0 StopPrice=18413,25 SignalName='Stoploss' FromEntrySignal='Friday:10:14-36'
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Amended matching order at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=200 LimitPrice=0 StopPrice=18413,25 SignalName='Stoploss' FromEntrySignal='Friday:10:14-36'
Time 11/04/2025 10:13:00 : Placing exit MIT orders for LONG position
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=MIT Quantity=33 LimitPrice=0 StopPrice=18590,25 SignalName='LE125(18590,25)(10-13-0)' FromEntrySignal='Friday:10:14-36'
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=MIT Quantity=33 LimitPrice=0 StopPrice=18555,00 SignalName='LE100(18555)(10-13-0)' FromEntrySignal='Friday:10:14-36'
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=MIT Quantity=33 LimitPrice=0 StopPrice=18519,75 SignalName='LE75(18519,75)(10-13-0)' FromEntrySignal='Friday:10:14-36'
11/04/2025 10:13:12 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:12: BarsInProgress=0 Action=Sell OrderType=MIT Quantity=68 LimitPrice=0 StopPrice=18495,25 SignalName='LE25(18495,25)(10-13-0)' FromEntrySignal='Friday:10:14-36'
Time 11/04/2025 10:13:00:
Execution:execution='0f35163a122145709e9ffdaf1fe7d f0e' instrument='MNQ JUN25' account='Playback101' exchange=Default price=18494.75 quantity=1 marketPosition=Short orderId='15b7ed2abdea44b2ad27e75cfbb80481' time='2025-04-11 10:13:22' sod=False statementDate='2025-04-11'
Execution.order
rderId='15b7ed2abdea44b2ad27e75cfbb80481' account='Playback101' name='LE25(18495,25)(10-13-0)' orderState=PartFilled instrument='MNQ JUN25' orderAction=Sell orderType='MIT' limitPrice=0 stopPrice=18495.25 quantity=68 tif=Gtc oco='' filled=1 averageFillPrice=18494.75 onBehalfOf='' id=761 time='2025-04-11 10:13:22' gtd='2099-12-01' statementDate='2025-04-11'EntryOrder
rderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=Filled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=200 averageFillPrice=18475.7475 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'Time 11/04/2025 10:13:00: execution happened, still LONG, adjust stoploss contracts
Time 11/04/2025 10:13:00: adjust LONG stop contracs to 199
11/04/2025 10:13:22 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:22: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=199 LimitPrice=0 StopPrice=18413,25 SignalName='Stoploss' FromEntrySignal='Friday:10:14-36'
11/04/2025 10:13:22 Strategy 'MWFuturesOpeningRangeGap/355822868': Amended matching order at 11/04/2025 10:13:22: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=199 LimitPrice=0 StopPrice=18413,25 SignalName='Stoploss' FromEntrySignal='Friday:10:14-36'
11/04/2025 10:13:22 Strategy '355822868/MWFuturesOpeningRangeGap: Cancelled pending exit order, since associated position is closed, orderId='e804335f825346d3ae7f9a3122ccc4a4' account='Playback101' name='LE75(18519,75)(10-13-0)' orderState=Accepted instrument='MNQ JUN25' orderAction=Sell orderType='MIT' limitPrice=0 stopPrice=18519.75 quantity=33 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=760 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'
11/04/2025 10:13:22 Strategy '355822868/MWFuturesOpeningRangeGap: Cancelled pending exit order, since associated position is closed, orderId='136dced9f5774483b77b99422f0f111b' account='Playback101' name='LE100(18555)(10-13-0)' orderState=Accepted instrument='MNQ JUN25' orderAction=Sell orderType='MIT' limitPrice=0 stopPrice=18555 quantity=33 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=759 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'
11/04/2025 10:13:22 Strategy '355822868/MWFuturesOpeningRangeGap: Cancelled pending exit order, since associated position is closed, orderId='1643096df8ef497c893d4b86d1d0ce3e' account='Playback101' name='LE125(18590,25)(10-13-0)' orderState=Accepted instrument='MNQ JUN25' orderAction=Sell orderType='MIT' limitPrice=0 stopPrice=18590.25 quantity=33 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=758 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'
11/04/2025 10:13:22 Strategy '355822868/MWFuturesOpeningRangeGap: Cancelled pending exit order, since associated position is closed, orderId='f51c79723c1240ab9fcb4f7fa285d515' account='Playback101' name='Stoploss' orderState=Accepted instrument='MNQ JUN25' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=18413.25 quantity=199 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=757 time='2025-04-11 10:13:22' gtd='2099-12-01' statementDate='2025-04-11'
Time 11/04/2025 10:13:00:
Execution:execution='a4c0cd64db4c4547bab772c70d52b 9ed' instrument='MNQ JUN25' account='Playback101' exchange=Default price=18494.5 quantity=67 marketPosition=Short orderId='15b7ed2abdea44b2ad27e75cfbb80481' time='2025-04-11 10:13:22' sod=False statementDate='2025-04-11'
Execution.order
rderId='15b7ed2abdea44b2ad27e75cfbb80481' account='Playback101' name='LE25(18495,25)(10-13-0)' orderState=Filled instrument='MNQ JUN25' orderAction=Sell orderType='MIT' limitPrice=0 stopPrice=18495.25 quantity=68 tif=Gtc oco='' filled=68 averageFillPrice=18494.5036764706 onBehalfOf='' id=761 time='2025-04-11 10:13:22' gtd='2099-12-01' statementDate='2025-04-11'EntryOrder
rderId='82ba51fd15e64a8c8bff2011aa96710f' account='Playback101' name='Friday:10:14-36' orderState=Filled instrument='MNQ JUN25' orderAction=Buy orderType='MIT' limitPrice=0 stopPrice=18475.25 quantity=200 tif=Gtc oco='' filled=200 averageFillPrice=18475.7475 onBehalfOf='' id=756 time='2025-04-11 10:13:12' gtd='2099-12-01' statementDate='2025-04-11'Time 11/04/2025 10:13:00: execution happened, still LONG, adjust stoploss contracts
Time 11/04/2025 10:13:00: adjust LONG stop contracs to 132
11/04/2025 10:13:22 Strategy 'MWFuturesOpeningRangeGap/355822868': Entered internal SubmitOrderManaged() method at 11/04/2025 10:13:22: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=132 LimitPrice=0 StopPrice=18413,25 SignalName='Stoploss' FromEntrySignal='Friday:10:14-36'
I tried:
- having fromSignalentry empty
- having fromsignalentry matched to enty order
- placing stoploss before limit entries
- placing stoploss after limit entries
- the quoted log contains trace orders
- the quoted log is the logic that is handled within OnExecutionUpdate override.
- in the logic of OnExecutionUpdate or onBarUpdate (which is set to calculate on bar close), we never enter a statement that would close these order manually.
I never have had this issue before with creating strategies and could not find an answer in previous asked questions matching my exact scenario.
Kind regards,
Jelle

Comment