Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

No OnOrderUpdate() callback for TDA OCOs

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

    No OnOrderUpdate() callback for TDA OCOs

    Hello,

    Is there a known technical limitation when submitting OCO orders to TDA from an Unmanaged NinjaScript strategy?

    The strategy's OnOrderUpdate()/OnExecutionUpdate() doesn't appear to be getting called for those OCO orders after they are submitted.

    Thanks.
    Trade Above, LLC
    NinjaTrader Ecosystem Vendor - tradeabove.com

    #2
    Hello, thanks for writing in. We have not had any other users report this issue. I will test a script on the market open tomorrow to see what I get. Ill report back here once I have completed the test.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chris.
      Trade Above, LLC
      NinjaTrader Ecosystem Vendor - tradeabove.com

      Comment


        #4
        Hi, I am getting OnOrderUpdate events on the unmanaged orders using the TDAmeritrade connection. The test I did is simple order submission in OnBarUpdate on the first real-time bar, then I print the order details in OnOrderUpdate and OnExecutionUpdate.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Thanks for testing this, Chris. Did your test include OCO orders? My scenario is a market order entry and a stop/target OCO pair. These are live (non-sim) orders.

          I've attached an image to show what I'm seeing. The Submitted state seems to be the last thing processed by the strategy's OnOrderUpdate() for OCO orders. Subsequent order updates are showing in the NT log file with name "External" and not being processed by the strategy.

          ​​
          Attached Files
          Trade Above, LLC
          NinjaTrader Ecosystem Vendor - tradeabove.com

          Comment


            #6
            Hi, I am using OCO. I have attached my test script that submits two buy orders above and below the market in OCO if you would like to try it out. Make sure you are also running the latest version of NinjaTrader R27.1. You can download it here:


            Attached Files
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Thanks for this. Were you using a live TD Ameritrade account for your test?
              Trade Above, LLC
              NinjaTrader Ecosystem Vendor - tradeabove.com

              Comment


                #8
                Hi, I am using a live TD Ameritrade account. If possible, try testing on a different computer to see if it's your development environment causing the issue. Test both your script and my script.
                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks for confirming.

                  I have limited access to this trading environment, so I only recently was able to run your test script. Unfortunately it was the same result: Summitted is the last order state processed by the strategy's OnOrderUpdate() for the OCO orders. These orders then show up in the logs with name "External".

                  (Note: I tried both my script and your script with the TDA connection but Sim101 instead of the live account, and had no issues. So the issue is exclusively with live OCO orders submitted to TDA)

                  I appreciate any assistance with next steps to identify the problem. Thanks.
                  Trade Above, LLC
                  NinjaTrader Ecosystem Vendor - tradeabove.com

                  Comment


                    #10
                    Hello, thanks for the follow up. I must recommend you test on a clean installation to see what might be causing this. If possible test on a different computer. If you are using a virtual machine or VPS please test on real hardware.

                    To preform a complete re-installation, and save your old installation:

                    HTML Code:
                    Navigate to your Documents folder > Right-click on the 'NinjaTrader 8' folder > Rename > rename the folder to 'NinjaTrader 8 OLD'. DO NOT delete this folder.
                    
                    Uninstall NinjaTrader within Windows Control Panel.
                    
                    Navigate to C:\ > Program File (x86) > Delete the 'NinjaTrader 8' folder if it exists
                    
                    Reboot your PC.
                    
                    Once these steps are completed, download and install NT8 from the link below:
                    
                    https://ninjatrader.com/GetStarted​
                    NinjaTrader looks for a folder called "NinjaTrader 8" in the documents, so reversing this process will revert back to your old installation.
                    Last edited by NinjaTrader_ChrisL; 01-24-2023, 03:19 PM.
                    Chris L.NinjaTrader Customer Service

                    Comment


                      #11
                      Chris, that did the trick! Thank you for your help.

                      This was on a physical machine (not VPS) and already had a very new install of NT. Btw, when I did the reinstall I used the old NT Config file.

                      Can you shed any light on what could be the cause? Is there anything that can be done to prevent this in the future?
                      Trade Above, LLC
                      NinjaTrader Ecosystem Vendor - tradeabove.com

                      Comment


                        #12
                        Hi, Im glad the new installation helped this issue. I could not say what the issue was as I was not able to reproduce it at all, and we did not have any others writing in about it. It could have been specific to your development environment.
                        Chris L.NinjaTrader Customer Service

                        Comment


                          #13
                          Your suggestion to reinstall made me wonder if you had an inclining based on previous experience with a similar issue. I'll also note that this was a very clean environment, and the only development work done in the environment was compiling the source code of this strategy (dev was done on another PC). NT had been installed for this purpose only a few weeks prior.

                          Thanks again.
                          Trade Above, LLC
                          NinjaTrader Ecosystem Vendor - tradeabove.com

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by dbennett3, Today, 01:59 PM
                          2 responses
                          4 views
                          0 likes
                          Last Post dbennett3  
                          Started by tkaboris, Today, 01:42 PM
                          2 responses
                          4 views
                          0 likes
                          Last Post tkaboris  
                          Started by DerkWehler, Today, 11:35 AM
                          12 responses
                          21 views
                          0 likes
                          Last Post DerkWehler  
                          Started by webus, Today, 06:22 AM
                          4 responses
                          20 views
                          0 likes
                          Last Post webus
                          by webus
                           
                          Started by DayTradingDEMON, 07-11-2024, 08:54 AM
                          16 responses
                          48 views
                          0 likes
                          Last Post DayTradingDEMON  
                          Working...
                          X