Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Relationship between OrderStatus() and NTmarketPosition() functions?

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

    Relationship between OrderStatus() and NTmarketPosition() functions?

    Hello,

    I'm using tradestation + NT DLL.

    Let's assume my position at my broker is FLAT and then suddenly a tick flows through on the tradestation charts which causes tradestation to send a BUY order to NT. If i then call OrderStatus() and it returns "filled", does this mean that calling NTmarketPosition() straight after calling OrderStatus() will certainly return a value of 1 ?

    In other words, once the order has been filled, how long does it then take for NTmarketPosition() to update to reflect the new position (ie flat, long, short)?

    In my tradestation code, is it safe to call NTmarketPosition() straight after OrderStatus() is returning "filled"? or should i wait say 1 second or 500 milliseconds after OrderStatus() returns "Filled" before i call NTmarketPosition() to check what my true position is at my broker?

    Im thinking that once OrderStatus() is telling me that my order has been "filled" it still might take another 100-500 milliseconds for NTmarketPosition() to update after the order has been filled? Is this a fair estimation?

    Thanks in advance.

    Regards

    Rod
    Last edited by Rocket130713; 10-18-2008, 12:11 AM.

    #2
    >> In my tradestation code, is it safe to call NTmarketPosition() straight after OrderStatus() is returning "filled"? or should i wait say 1 second or 500 milliseconds after OrderStatus() returns "Filled" before i call NTmarketPosition() to check what my true position is at my broker?

    May or may not work. Reason: OnOrderStatus indicates an order update event, whereas NTMarketPosition queries the current position.

    Better check out the NinjaScript event "OnPositionUpdate". But there still could be a delay until the new position data made it to the ATI client running within the scope of the TradeStation process.

    Comment


      #3
      Hi Dierk,

      Thanks for your reply.

      Why in your answer do you refer to NinjaScript functions "OnOrderStatus" and "OnPositionUpdate" when im using TradeStation code and not NinjaScript code?

      Given this, does your answer change?

      OrderStatus() DLL function is refered to in Appendixes A at the bottom of your help guide.

      It would be good if once OrderStatus() returns "filled" then calling NTmarketPosition() straight after would definitely return the updated market position. Is there any way you can ensure this happens by changing some code on your end? As I cant seem to program some sort of time delay between calling OrderStatus() and calling NTmarketPosition in TradeStation EasyLanguage, as TS EasyLanguage does not have a Sleep() function like in C++

      Comment


        #4
        My apologies, I thought you were referring to the equivalent NinjaScript method.

        To iterate: Your assumption still is not correct for reasons below. Unfortunately we can't change that logic.

        If you need that level of control then checking out NinjaScript might be of value.

        Comment


          #5
          thanks Dierk. Just found a solution using TradeStation EL code and E-signal EFS code. After i send an order to NT, i wait until order is filled, then wait 2 seconds from time filled before we call NTmarketPosition. The 2 seconds, i hope, should be plenty of time for NTmarketPosition to update in real-time to reflect the true position at our broker. So if it takes 1 second to get a fill, i then wait another 2 seconds before i call NTmarketPosition. Hopefully this will make sure that when i call NTmarketPosition it returns the true broker position.

          if anyone else has any other ideas on how to solve this problem please let us know ?

          thanks in advance.

          Rod

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PaulMohn, Today, 03:49 AM
          0 responses
          7 views
          0 likes
          Last Post PaulMohn  
          Started by inanazsocial, Today, 01:15 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by rocketman7, Today, 02:12 AM
          0 responses
          10 views
          0 likes
          Last Post rocketman7  
          Started by dustydbayer, Today, 01:59 AM
          0 responses
          4 views
          0 likes
          Last Post dustydbayer  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          23 views
          0 likes
          Last Post trilliantrader  
          Working...
          X