The ChangeOrder method doesn't seem to be working as expected in my strategy. I'm following managed orders approach. Here is the flow of calls to order methods in my strategy:
1. In OnBarUpdate():
SetStopLoss(signalNameLong, CalculationMode.Price, stopLoss, false);
EnterLong(defaultQuantity, signalNameLong);
buyStopLossOrder.IsLiveUntilCancelled = true;
ChangeOrder(buyStopLossOrder, buyStopLossOrder.Quantity, 0, stopLoss);
2020-05-25 21:47:00:473|1|32|Order='e3b25d5cb10b4f4784810b5e650d59d2/Sim101' Name='Stop loss' New state='Change submitted' Instrument='NQ 06-20' Action='Sell' Limit price=0 Stop price=[B]9534 [/B]Quantity=1 Type='Stop Market' Time in force=GTC Oco='40b5aff15a62416abb8818d70414d851' Filled=0 Fill price=0 Error='No error' Native error='' 2020-05-25 21:47:00:582|1|32|Order='e3b25d5cb10b4f4784810b5e650d59d2/Sim101' Name='Stop loss' New state='Accepted' Instrument='NQ 06-20' Action='Sell' Limit price=0 Stop price=[B]9522.25[/B] Quantity=1 Type='Stop Market' Time in force=GTC Oco='40b5aff15a62416abb8818d70414d851' Filled=0 Fill price=0 Error='No error' Native error=''
2020-05-25 21:47:00:472 (My NinjaTrader Continuum) Cbi.Account.Change0: realOrderState=Accepted orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangePending instrument='NQ 06-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=[B]9522.25[/B] quantity=1 tif=Gtc oco='40b5aff15a62416abb8818d70414d851' filled=0 averageFillPrice=0 onBehalfOf='' id=12677 time='2020-05-25 21:47:00' gtd='2099-12-01' statementDate='2020-05-25' limitPriceChanged=0 stopPriceChanged=9534 quantityChanged=1 2020-05-25 21:47:00:472 (My NinjaTrader Continuum) Cbi.Account.OrderUpdateCallback: realOrderState=ChangePending orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangePending instrument='NQ 06-20' orderAction=Sell limitPrice=0 stopPrice=9522.25 quantity=1 orderType='Stop Market' filled=0 averageFillPrice=0 time='2020-05-25 21:47:00' statementDate='2020-05-25' error=NoError comment='' nr=-1 2020-05-25 21:47:00:473 (My NinjaTrader Continuum) Cbi.Account.Change1: realOrderState=ChangePending orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangeSubmitted instrument='NQ 06-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=9534 quantity=1 tif=Gtc oco='40b5aff15a62416abb8818d70414d851' filled=0 averageFillPrice=0 onBehalfOf='' id=12677 time='2020-05-25 21:47:00' gtd='2099-12-01' statementDate='2020-05-25' limitPriceChanged=0 quantityChanged=1 stopPriceChanged=9534 2020-05-25 21:47:00:473 (My NinjaTrader Continuum) Cbi.Simulator.Change: realOrderState=ChangePending orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangeSubmitted instrument='NQ 06-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=9534 quantity=1 tif=Gtc oco='40b5aff15a62416abb8818d70414d851' filled=0 averageFillPrice=0 onBehalfOf='' id=12677 time='2020-05-25 21:47:00' gtd='2099-12-01' statementDate='2020-05-25' limitPriceChanged='0' quantityChanged='1' stopPriceChanged='9534' delay=100 2020-05-25 21:47:00:473 (My NinjaTrader Continuum) Cbi.Account.OrderUpdateCallback: realOrderState=ChangeSubmitted orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangeSubmitted instrument='NQ 06-20' orderAction=Sell limitPrice=0 stopPrice=9534 quantity=1 orderType='Stop Market' filled=0 averageFillPrice=0 time='2020-05-25 21:47:00' statementDate='2020-05-25' error=NoError comment='' nr=-1 2020-05-25 21:47:00:473 (My NinjaTrader Continuum) Cbi.Account.Change0: realOrderState=ChangeSubmitted orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangePending instrument='NQ 06-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=9534 quantity=1 tif=Gtc oco='40b5aff15a62416abb8818d70414d851' filled=0 averageFillPrice=0 onBehalfOf='' id=12677 time='2020-05-25 21:47:00' gtd='2099-12-01' statementDate='2020-05-25' limitPriceChanged=0 stopPriceChanged=9522.25 quantityChanged=1 2020-05-25 21:47:00:473 (My NinjaTrader Continuum) Cbi.Account.OrderUpdateCallback: realOrderState=ChangePending orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangePending instrument='NQ 06-20' orderAction=Sell limitPrice=0 stopPrice=9534 quantity=1 orderType='Stop Market' filled=0 averageFillPrice=0 time='2020-05-25 21:47:00' statementDate='2020-05-25' error=NoError comment='' nr=163 2020-05-25 21:47:00:473 (My NinjaTrader Continuum) Cbi.Account.QueueChange: realOrderState=ChangeSubmitted orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=ChangePending instrument='NQ 06-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=9534 quantity=1 tif=Gtc oco='40b5aff15a62416abb8818d70414d851' filled=0 averageFillPrice=0 onBehalfOf='' id=12677 time='2020-05-25 21:47:00' gtd='2099-12-01' statementDate='2020-05-25' 2020-05-25 21:47:00:582 (My NinjaTrader Continuum) Cbi.Account.OrderUpdateCallback: realOrderState=Accepted orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=Accepted instrument='NQ 06-20' orderAction=Sell limitPrice=0 stopPrice=9522.25 quantity=1 orderType='Stop Market' filled=0 averageFillPrice=0 time='2020-05-25 21:47:00' statementDate='2020-05-25' error=NoError comment='' nr=-1 2020-05-25 21:47:00:582 (My NinjaTrader Continuum) Cbi.Account.OrderUpdateCallback.DiscardRetryChange: orderId='e3b25d5cb10b4f4784810b5e650d59d2' account='Sim101' name='Stop loss' orderState=Accepted instrument='NQ 06-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=9522.25 quantity=1 tif=Gtc oco='40b5aff15a62416abb8818d70414d851' filled=0 averageFillPrice=0 onBehalfOf='' id=12677 time='2020-05-25 21:47:00' gtd='2099-12-01' statementDate='2020-05-25' limitPriceChanged=0 stopPriceChanged=9522.25 quantityChanged=1
Thanks,
CV
Comment