Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position Update Not reliable?

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

    Position Update Not reliable?

    Hello,

    With Apex / Rithmic, I've noticed I don't always receive the position update information in an indicator which causes problems.


    NT log records related to account and an order + execution.
    10:04:00 AM Execution Execution='28xxx|15569xxx|15569xxx' Instrument='MNQ 09-24' Account='APEX-74xxx-18' Exchange=Globex Price=19991.5 Quantity=1 Market position=Short Operation=Operation_Add Order='15569xxx' Time='6/26/2024 10:04 AM'
    10:04:00 AM Order Order='15569xxx/APEX-74xxx-18' Name='D48...' New state='Filled' Instrument='MNQ 09-24' Action='Sell' Limit price=19991.5 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='' Filled=1 Fill price=19991.5 Error='No error' Native error=''

    Other accounts received the position update, but this account filled an execution as well, but no position update. No position data in the NT log. I received a position update for an order placed later, but not this one.

    Is this not a reliable event?

    Thank you







    #2
    Hello neo302,

    Thank you for your post.

    For Rithmic and Interactive Brokers connections, the events from OnOrderUpdate(), OnPositionUpdate(), and OnExecutionUpdate() are not guaranteed to arrive in a specific order. The key is to have your strategy set up so that it does not depend on Order, Position, or Execution information to be obtained in any order.

    From the Help Guide:

    "Rithmic and Interactive Brokers Users: When using a NinjaScript strategy it is best practice to only work with passed by value data from OnExecution. Instances of multiple fills at the same time for the same instrument might result in an incorrect OnPositionUpdate, as sequence of events are not guaranteed due to provider API design. For an example on protecting positions with this approach, see OnExecutionUpdate()​"



    We have some example scripts that are Rithmic/IB friendly on the forum. These are designed so that the logic does not rely on event updates in a specific order:



    Please let us know if you have any further questions.

    Comment


      #3
      Originally posted by NinjaTrader_Gaby View Post
      Hello neo302,

      Thank you for your post.

      For Rithmic and Interactive Brokers connections, the events from OnOrderUpdate(), OnPositionUpdate(), and OnExecutionUpdate() are not guaranteed to arrive in a specific order. The key is to have your strategy set up so that it does not depend on Order, Position, or Execution information to be obtained in any order.

      From the Help Guide:

      "Rithmic and Interactive Brokers Users: When using a NinjaScript strategy it is best practice to only work with passed by value data from OnExecution. Instances of multiple fills at the same time for the same instrument might result in an incorrect OnPositionUpdate, as sequence of events are not guaranteed due to provider API design. For an example on protecting positions with this approach, see OnExecutionUpdate()​"



      We have some example scripts that are Rithmic/IB friendly on the forum. These are designed so that the logic does not rely on event updates in a specific order:



      Please let us know if you have any further questions.
      Hello NinjaTrader_Gaby,

      I am aware the order of events are not guaranteed. I did not receive the position update event at all.
      The reliability of receiving the position update events is my question, not the order.

      Thank you

      Comment


        #4
        Hello,

        I recommend using PositionUpdate() to subscribe to position update events. The example code in the Help Guide page below demonstrates printing out this information for any new position updates.



        You can also print out the order and execution objects from OrderUpdate and ExecutionUpdate.





        This way we can see if the script is indeed not receiving any position updates when it should.

        Comment


          #5
          Originally posted by NinjaTrader_Gaby View Post
          Hello,

          I recommend using PositionUpdate() to subscribe to position update events. The example code in the Help Guide page below demonstrates printing out this information for any new position updates.



          You can also print out the order and execution objects from OrderUpdate and ExecutionUpdate.





          This way we can see if the script is indeed not receiving any position updates when it should.

          Hello,

          I am subscribed to the position update as that is how I received the position update information for the other accounts including the non missing position update for the APEX-74xxx-18 account. The problem is I didn't receive one single position update. Therefore my indicator, not strategy, thought it was still long when in reality it was flat.

          Let me restate the situation:

          I have multiple accounts placing orders and using the indicator.
          I received all of the position update events except for one single individual event.
          I only received the order and execution information for this order as shown in the log tab of Ninja Trader and it matches my indicators logging exactly.

          Info from the Ninja Trader log:
          10:04:00 AM Execution Execution='28xxx|15569xxx|15569xxx' Instrument='MNQ 09-24' Account='APEX-74xxx-18' Exchange=Globex Price=19991.5 Quantity=1 Market position=Short Operation=Operation_Add Order='15569xxx' Time='6/26/2024 10:04 AM'
          10:04:00 AM Order Order='15569xxx/APEX-74xxx-18' Name='D48...' New state='Filled' Instrument='MNQ 09-24' Action='Sell' Limit price=19991.5 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='' Filled=1 Fill price=19991.5 Error='No error' Native error=''

          Other accounts received all the position updates.
          This Apex account APEX-74xxx-18 filled an execution, but never received a position update for this exact execution fill instance.

          The prior execution on this APEX-74xxx-18 account did receive the position update.
          10:03:41 AM Position Instrument='MNQ 09-24' Account='APEX-74xxx-18' Average price=19982.75 Quantity=1 Market position=Long Operation=Operation_Add

          The following execution on this account did receive the position update.
          10:04:15 AM Position Instrument='MNQ 09-24' Account='APEX-74xxx-18' Average price=19982.75 Quantity=1 Market position=Flat Operation=Remove
          I did not receive a position update in a single case, therefore my indicator had the position information wrong and that clearly causes problems.

          This is why I'm asking if position update is a reliable event.

          Thank you
          Last edited by neo302; 06-26-2024, 06:55 PM.

          Comment


            #6
            Hello neo302,

            Thank you for your response.

            Can you please email us your log and trace files, along with the order ID of the order that is missing the position update?

            You can do this by going to the Control Center-> Help-> Email Support

            Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

            Please reference the following ticket number in the body of the email: Case Number: 04476810 ATTN Gaby​

            Comment


              #7
              Originally posted by NinjaTrader_Gaby View Post
              Hello neo302,

              Thank you for your response.

              Can you please email us your log and trace files, along with the order ID of the order that is missing the position update?

              You can do this by going to the Control Center-> Help-> Email Support

              Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

              Please reference the following ticket number in the body of the email: Case Number: 04476810 ATTN Gaby​
              Email sent.
              Thank you!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              557 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X