Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reasons for market orders not to be filled within 60sec ?!

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

    reasons for market orders not to be filled within 60sec ?!

    Hi, have a strategy submitting non-NT8-managed orders, most of the time - they are updated from Submitted, Accepted to Filled in a second... but sometimes (?!) they wait for minutes -- all in State.Realitme, however, note that this is a Playback connection with Market-level data.

    What could be possible reasons for a market order not to be filled for so long? What is worse, is that after I implemented a time-out to cancel these after, say, 60sec -
    I often get issues with my strategy stopping with an error about "Historical order modified while transitioning into Realtime"...

    I did try to read through some info on NT8 fill-logic, but honestly, it was still not easy to really understand, why a market-price order would not be filled withing a few seconds? Can you help me understand this, please?

    #2
    Hello momchi,

    Thank you for your post.

    If this is occurring on Market Replay data, we would suspect perhaps a lag in performance; I would need to see a test script that submits an order on the bar in question. I'd also need to know what date you are getting the behavior on at what playback time, along with what time zone you are in.

    The issue you're running into with modifying a historical order that's transitioning to real time is because you likely aren't updating the order references when the strategy transitions to real time. Here's a link to our help guide on transitioning orders:



    There's a working example in SampleOnOrderUpdate here:



    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Hi Kate - thank you for the reply and hints. I will look more into the order reference update.

      In the meantime - while preparing log files to add to this, noticed that my OnOrderUpdate() method was not called as it would normally - during this transition.
      From the trace file it seems that the order is "Filled", but the (Playback Connection) Cbi.Account.OrderUpdateCallback: realOrderState=Filled callback did not call my override of OnOrderUpdate(), possibly due to this transitioning. Could you please take a peek at the log files, and see if there is something else wrong that you see/not see?

      Thanks,
      Momchil
      Attached Files
      Last edited by NinjaTrader_Kate; 05-22-2020, 10:41 AM.

      Comment


        #4
        To add - my OnOrderUpdate() is really simple, it mostly updates my strategy object data slot for "lastOrder", which I refer to inside the strategy's OnBarUpdate().

        protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
        {
        // Assign lastOrder in OnOrderUpdate() to ensure the assignment occurs when expected.
        // This is more reliable than assigning Order objects in OnBarUpdate, as the assignment is not gauranteed to be complete if it is referenced immediately after submitting
        lastOrder = order;

        Print("-> DEBUG -> OnOrderUpdate(): order '" + order.Name + "' (" + order.OrderId + ") state: " + order.OrderState.ToString() );

        ... you don't see these -> DEBUG -> statements called for the last order (transitioning into Realtime), see NinjaScript Output file attached previously.

        Thank you,
        Momchil

        Comment


          #5
          Hello momchi,

          Thank you for your replies.

          Just to let you know, I removed the log and trace files from your post as they may contain personally identifiable information. It certainly does look like that what you're running into is a problem with transitioning the orders to real time, so I would see how the behavior is after you've added the code to allow the order to transition properly to real time. After you've added it, do you still get errors with the market orders not filling for 60 or more seconds?

          Thanks in advance; I look forward to assisting you further.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          119 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          62 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          45 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          82 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X