Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order Cancel Pending

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

    Order Cancel Pending

    Hello,
    I have been running a strategy on a sim account that frequently runs into an issue where an order from the strategy is left in the "cancel pending" state. How may I alter the code to avoid this error?

    #2
    Hello,

    you can remove these type of orders on the sim account by resetting the sim account from the edit account menu. Depending on your code you may need to make changes to avoid that from happening.
    Last edited by NinjaTrader_Jesse; 02-22-2024, 08:22 AM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      For reference, I am using limit orders in the code, what changes would I need to make to the code to avoid it from happening?

      Comment


        #4
        Hello samish18,

        I really wouldn't be able to say without knowing exactly how your code executed when you saw the order get stuck. Orders can become stuck on the sim for various reasons, this usually entails that some kind of race event meaning two conflicting actions happening at the same time.

        If you have a specific way to reproduce the problem I would suggest to extract the relevant part of the code that shows where the orders are being called or cancelled and then make a small sample of that so you can attach it to the forum. Based on that example we may be able to recommend alternative actions. You would otherwise need to debug the strategy to see which specific parts of your logic are being affected when you see this happen.


        JesseNinjaTrader Customer Service

        Comment


          #5
          My code is fairly simple, it repeatedly enters limits orders:
          if (Close[0] > Close[1]) EnterLongLimit(1, Close[0] - gap*TickSize, "Enter Long");

          Comment


            #6
            Hello samish18,

            If you have a condition which is not always true and continue to resubmit orders that would allow for the order to be expired, you may be seeing this due to the order expiring but then you try to resubmit the order again shortly after. That would likely only happen if you are executing this code at tick frequency where there may be a short time for the cancellation to go through but the condition could become true again to resubmit the order.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            11 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            10 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            11 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,981 views
            3 likes
            Last Post jhudas88  
            Started by rbeckmann05, Yesterday, 06:48 PM
            0 responses
            9 views
            0 likes
            Last Post rbeckmann05  
            Working...
            X