Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Filled order fails to report with IB

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

    Filled order fails to report with IB

    I know this has been discussed before but I have new information so I decided to open a new thread because it is such important issue.

    The problem:
    An order is filled at the broker (my case IB). The status of the order is reported as "Partialled Filled", the NTMarketPosition returns 0. The client has no way to know how many shares so that an stop can be sent. This happens to me probably once or twice a week. There is usually a delay of a few ticks once in a while and the status is returned. That is not the problem. The problem is the orders where the status is never returned. I have stayed waiting for the MarketPosition and status to change for about 2 minutes. I found that if I shutdown NT (That is correct in the middle of trading) and restart the status and MarkePosition are immediatelly retuned upon restart. Of course my code is smart enough to detect the disconnect from NT and then reconnect.

    This interim solution is not satisfactory because you still need to be baby sitting the trades. I would like to be able to trade FX overnight without having to worry about this. This is the only road block so far.

    Moscu

    #2
    Can you not use NTFilled()?

    int NTFilled(string orderId)
    Gets the number of contracts/shares filled for the orderId.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Let me give you a picture of my current trading setup. I have hundreds of charts. These charts contain the same symbol in multiple timeframes, for multiple strategies. I finally was able to achieve this with NinjaTrader DLL. To be able to synchronize these orders so that one chart/strategy does not conflict with another one is very dificult. What you asking it might work for a simple system with one chart/strategy per symbol. First I will need to keep the entry order around so I can keep using it to query. Second this will prevent me from pyramiding orders because I would not know how much is the total position at that moment which is what I am interested on. Second I have multiple profit orders. So when one of this is triggered the initial position would not be valid any longer. Building a system where you need to keep all this orders and adding them up so you can tell your current position is not ideal and reliable.

      Moscu

      Comment


        #4
        Moscu,

        I understand for your complex environment that it can be a daunting task, but I assure you it is reliable. You will want to keep your orderIds around and maybe even loop through NTOrders() to get the information you need.

        Another suggestion, could you not use NTStrategyPosition() to get the amount you are filled?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I can quickly think of two reasons why what you suggest does not really works. Once is that Tradestation have a limitation of 500 chars per string. NTOrders returns an string with all the orders. My order id looks like this:
          "BUY-LE H2-T35-942-35-STOPLIMIT-64.61-64.78". Now if I am trading in a volatile day I can generate enough orders to fill 500 chars in an hour (entry/exits). So I already post about this problem with NTOrders and NT indicated it will be fixed in a future release.

          Second another strategy might want to reverse the current position. This second strategy would not have access to the entry order in another strategy. So the reverse command that I use:
          NtCommand(Command, Account, Action, Share_Count,OrderType,Round(LimitPrice,DecP),Round (StopPrice,DecP),
          "DAY", "",NewOrderId, "", "");

          It would not work because the Share_Count would be wrong. The current number of shares of a position needs to be available to all the strategies/charts running in the same symbol for them to function properly. Even If I could use NTOrders/NTFilled (assuming NTOrders works fine) it would still not work because the filled order could have been an hour ago or two. MarketPosition is what the function name means. The current position for a given symbol at at given time. This must be known in a reliable way to any client that calls the NT DLL. It could be across multiple computers.

          I hope you get my point this is a critical item that needs to be made work reliable.

          Moscu

          Comment


            #6
            Also could you explain how the function


            string NTStrategyPosition(string strategyId)
            Gets the position of a strategy. Returns 0 for flat, negative for short and positive for long.

            works for a DLL client calling this from tradestation? What is my strategyId?


            Moscu

            Comment


              #7
              We understand your point and I can see that for your situation, our current limitation is frustrating. Unfortunately, it is what it is for now and it is on our list to address in the future.

              StrategyId is a user defined parameter that is passed in when calling NTCommand() for initiating an ATM strategy. The StrategyId references the ATM stragegy that is created.
              RayNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Waxavi, Today, 02:10 AM
              0 responses
              4 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by TradeForge, Today, 02:09 AM
              0 responses
              9 views
              0 likes
              Last Post TradeForge  
              Started by Waxavi, Today, 02:00 AM
              0 responses
              2 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by elirion, Today, 01:36 AM
              0 responses
              4 views
              0 likes
              Last Post elirion
              by elirion
               
              Started by gentlebenthebear, Today, 01:30 AM
              0 responses
              4 views
              0 likes
              Last Post gentlebenthebear  
              Working...
              X