Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Orders not cancelling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Orders not cancelling

    Hi,
    I've not seen this before but right now I have an NT8 (v19) strategy which can produce an order that is not cancellable. Literally calling CancelOrder(order) doesn't do anything. I've built a lot of printout to the Output Window to monitor it. You can see multiple attempts over multiple bars are not cancelling the order named "LE".


    31/10/2019 1:30:00 AM GoLong()
    31/10/2019 1:30:00 AM Long limit order at entry price 3032.25
    31/10/2019 1:30:00 AM Strategy 'tzMomentumStrategy/180132578': Entered internal SubmitOrderManaged() method at 31/10/2019 1:30:00 AM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=3032.25 StopPrice=0 SignalName='LElmt' FromEntrySignal=''
    +ActiveOrders LE,LS,LT: True Working,False Filled,False Cancelled,+ SE,SS,ST: False Filled,False Filled,False Cancelled
    31/10/2019 2:00:00 AM OnBarUpdate() closeDirection 1 tradeDirection 1 momValue 6 momValid = True; doExit=False, doTrade=True allOrdersInactive=False
    31/10/2019 2:00:00 AM OnBarUpdate() doing trade 1
    31/10/2019 2:00:00 AM MyCancelAllOrders(True,True)
    Cancelling LE
    +ActiveOrders LE,LS,LT: True Working,False Filled,False Cancelled,+ SE,SS,ST: False Filled,False Filled,False Cancelled
    31/10/2019 2:30:00 AM OnBarUpdate() closeDirection -1 tradeDirection -1 momValue -9 momValid = True; doExit=False, doTrade=True allOrdersInactive=False
    31/10/2019 2:30:00 AM OnBarUpdate() doing trade -1
    31/10/2019 2:30:00 AM MyCancelAllOrders(True,True)
    Cancelling LE
    +ActiveOrders LE,LS,LT: True Working,False Filled,False Cancelled,+ SE,SS,ST: False Filled,False Filled,False Cancelled
    31/10/2019 3:00:00 AM OnBarUpdate() closeDirection -1 tradeDirection -1 momValue -2 momValid = True; doExit=False, doTrade=True allOrdersInactive=False
    31/10/2019 3:00:00 AM OnBarUpdate() doing trade -1
    31/10/2019 3:00:00 AM MyCancelAllOrders(True,True)
    Cancelling LE
    +ActiveOrders LE,LS,LT: True Working,False Filled,False Cancelled,+ SE,SS,ST: False Filled,False Filled,False Cancelled


    This brings the trading to a stop because the strategy is permanently waiting for all orders to be cancelled before doing its next step.

    FYI when the log says "Cancelling LE" the immediate next piece of code is
    CancelOrder(LE.order)
    LE is a class which contains various bits of information, including theOrder object.

    Assistance requested.
    Thanks,

    saltminer

    #2
    Hello saltminer,

    Thanks for your post.

    Without an example of the code that you are using, we couldn't comment on how you are hitting an issue. We have a sample demonstrating how CancelOrder should be used and this is working without issue on the latest version of NinjaTrader.

    The sample can be found here - https://ninjatrader.com/support/help...thod_to_ca.htm

    Please ensure your logic for using CancelOrder models after the example we provide. If you have a specific question, please provide a small example showing what you are doing so we can provide our insight.

    EDIT: Thanks for reaching out with an example over email. NinjaTrader_ChelseaB and I will review and follow up with our findings.

    I look forward to being of further assistance.
    Last edited by NinjaTrader_ChelseaB; 11-14-2019, 02:33 PM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi guys, I have a clear example of this problem still in existence.

      Here is a code snippet that is run every first tick of bar:

      if (OrderIsActive(LE) && LE.OrderType == OrderType.Limit)
      {
      Print(Time[AZ]+" cancelling LE, state "+LE.OrderState);
      CancelOrder(LE);
      }

      This is the Output text:

      28/08/2020 6:15:00 PM GoLong() Limit
      28/08/2020 6:15:00 PM Long entry limit order price calculated as 1.18939; current Ask is 1.18948
      28/08/2020 6:15:00 PM Strategy 'kwStochasticSystems Oct19/196723395': Entered internal SubmitOrderManaged() method at 28/08/2020 6:15:00 PM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.1893'9 StopPrice=0 SignalName='LE' FromEntrySignal=''
      28/08/2020 6:15:00 PM OnOrderUpdate(): LE Submitted pendingAction=-99, isTerminal=False for Submitted AllOrdersInactive()=True : orderId='NT-00494-1401' account='Sim101' name='LE' orderState=Submitted instrument='EURUSD' orderAction=Buy orderType='Limit' limitPrice=1.18939 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-08-28 18:15:00' gtd='2099-12-01' statementDate='2020-10-19'
      RefreshOrder LE Submitted
      28/08/2020 6:15:00 PM OnOrderUpdate(): LE Accepted pendingAction=-99, isTerminal=False for Accepted AllOrdersInactive()=False : orderId='NT-00494-1401' account='Sim101' name='LE' orderState=Accepted instrument='EURUSD' orderAction=Buy orderType='Limit' limitPrice=1.18939 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-08-28 18:15:00' gtd='2099-12-01' statementDate='2020-10-19'
      RefreshOrder LE Accepted
      28/08/2020 6:15:00 PM OnOrderUpdate(): LE Working pendingAction=-99, isTerminal=False for Working AllOrdersInactive()=False : orderId='NT-00494-1401' account='Sim101' name='LE' orderState=Working instrument='EURUSD' orderAction=Buy orderType='Limit' limitPrice=1.18939 stopPrice=0 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-08-28 18:15:00' gtd='2099-12-01' statementDate='2020-10-19'
      RefreshOrder LE Working
      28/08/2020 6:16:00 PM cancelling LE, state Working
      28/08/2020 6:17:00 PM cancelling LE, state Working
      28/08/2020 6:18:00 PM cancelling LE, state Working
      28/08/2020 6:19:00 PM cancelling LE, state Working
      28/08/2020 6:20:00 PM cancelling LE, state Working

      I have sent you files directly to the support email.

      saltminer

      Comment


        #4
        Hello saltminer,

        We have received your note reply including a 1000 line strategy that adds a timer. We will need to reduce the strategy so it demonstrates the issue in clear terms, and does not have the timer implemented/used. (Timers cannot be expected to function properly in a backtest or in playback. While you have code that ignores using them, we should be able to demonstrate this issue in a script that does not use the timer at all to rule out any logical missteps.)

        I have replied back to you over email, and I will be happy to continue working with you once we have a small test script to demonstrate the issue.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sandman, Today, 04:58 AM
        0 responses
        1 view
        0 likes
        Last Post sandman
        by sandman
         
        Started by Island_Boy_Trading, Today, 04:15 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by YevhenShynkarenko, Today, 04:18 AM
        0 responses
        2 views
        0 likes
        Last Post YevhenShynkarenko  
        Started by space_trader, Today, 04:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by Rebmr2, Today, 01:30 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Marco  
        Working...
        X