Announcement

Collapse
No announcement yet.

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.

    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.


        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.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            53 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X