Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderState() and NTmarketPosition functions

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

    OrderState() and NTmarketPosition functions

    hello,

    lets presume we are flat corn futures, then we send a market order to BUY 1 corn contract. Then we constantly call OrderStatus() every tick to find out if order was filled or rejected. Lets say it was in fact filled. My question is: Is it possible that even though OrderStatus() is returning "Filled" that when I call NTmarketPosition("") i get a return of zero which means the position in broker account has not updated yet to 1.

    Or is it the case that once OrderStatus() is returning "Filled" then NTmarketPosition() will always be correct and "up-dated"?

    What is the sequence order of events here, does the order get filled first and then the position is updated in NT / broker account? or is it visa versa?

    my TS EL code waits for a fill first via calling orderstatus and then it calls NTmarketposition next to see if the new order has been updated in my broker account. Is this the best way to go in relation to coding order handling? My goal here is not to put on the same order twice.

    thanks in advance.

    regards

    Rod

    #2
    Hello Rocket130713,

    There may be race conditions where update to the position event comes slightly later than the filled event but for the most part these should match up. The execution fill event will take place before the position update event.

    Your approach seems a good way to ensure that you are not submitting the same order twice.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      thanks RyanM. i also wait 2 seconds after my order is reported as "Filled" ( via calling orderstatus() function ) which gives NTmarketPosition() enough time to update to reflect the new position "Situation" and doing this stops me from putting on the same order twice (or greater than twice). thanks again. hope this can help someone else.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by The_Sec, Yesterday, 03:37 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by vecnopus, Today, 06:15 AM
      0 responses
      1 view
      0 likes
      Last Post vecnopus  
      Started by Aviram Y, Today, 05:29 AM
      0 responses
      5 views
      0 likes
      Last Post Aviram Y  
      Started by quantismo, 04-17-2024, 05:13 PM
      3 responses
      27 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      7 responses
      36 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X