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 Stanfillirenfro, Today, 07:23 AM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      2 responses
      20 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by olisav57, Yesterday, 07:39 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      7 responses
      944 views
      0 likes
      Last Post Jquiroz1975  
      Started by oviejo, Today, 12:28 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X