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

Can Strategy Instances be Added Programmatically?

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

    Can Strategy Instances be Added Programmatically?

    I run NinjaScript strategies from the Strategies tab in the NinjaTrader 8 Control Center. At present I add strategy instances to this tab manually using the "New Strategy..." item on the Context Menu for the Strategies tab. I'd prefer to add strategy instances to this tab programmatically. Is it possible to add strategy instances to the Strategies tab programmatically using a NinjaTrader Add-On or using some other way that is internal or external to NinjaTrader? If the answer to this question is yes, then would you please recommend an approach for doing this?

    #2
    Hello NtFan,

    This is not currently possible through any supported means, it is expected to manually apply and start strategies to ensure they are started when expected. I will put in a feature request for the ability to add strategies programatically.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I'd also like to make the request for this to be added. I currently have python code I wrote scanning for stocks and when they meet certain criteria it triggers an autohotkey script to click through the GUI to add a strategy. It would be much cleaner, faster, and more precise/accurate if I could add them programmatically using the same method call NT8 uses. Would you be able to say which DLL it calls and how so I can make an addon for it myself?

      Comment


        #4
        Is there perhaps any way to use the ATI, or the NTDirect.dll, or the File Interface to do it. Like I stated in the previous comment, I wrote a python script to create my strategies and can easily create a file for NT8 to read. Using the DLL is difficult but still doable.

        Comment


          #5
          Hello magnatauren,

          You can use the file interface to submit external orders however there is very limited amount of information that can be retrieved through that system. You can read about that here: https://ninjatrader.com/support/help...file+interface
          JesseNinjaTrader Customer Service

          Comment


            #6
            Yea, I read through the entirety of the ATI, NTDirect.dll, and File interface KB's and was unable to find anything on it. If possible could you just tell me a little information about how it's handled and I can make my own addon for it? Honestly if it were something like the file interface and could just accept a text file along the lines of

            Create Strategy(StrategyName, Instrument, enabled, otherparameters...)

            Unfortunately I can't just have a strategy running for each equity or else Kinetick chokes.

            Comment


              #7
              Hello magnatauren,

              Starting strategies is internal logic, that is not something which is exposed to the user in any form. The File interface would be used for simple order submission but has no means to control strategies. The other dll interface is not supported but still has no means to start a strategy.

              It sounds like from your post 3 that you already have a solution to this problem, as there is no NinjaScript way to accomplish this task I would suggest to just stick with that. There is a feature request in place for this so if development sees the need to add this they will update that and place the id in the change log.

              In general it is not expected to be able to control strategies through code, enabling a strategy is a deliberate action for the user to trade for them starting at that point. If you want something that runs in the background without enabling it you would have to avoid strategies completely and use an addon. https://ninjatrader.com/support/help...t_overview.htm







              JesseNinjaTrader Customer Service

              Comment


                #8
                Any another user (me) who requests this feature.

                Comment


                  #9
                  Hello Derjan,

                  We have added a vote to "SFT-2844" to track your interest behind having functionality available to programmatically start strategies.

                  This is an internal number, but for anyone else wishing to have their interest tracked, please let our support staff know that you would like a vote added for this request.

                  Feature Request Disclaimer

                  We receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing. As such we cannot offer an ETA or promise of fulfillment.

                  When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number will be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

                  Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by Derjan View Post
                    Any another user (me) who requests this feature.
                    You can use Reflection to copy any objects, then call any methods. But this all is on your own risk and unsupported

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Pattontje, Yesterday, 02:10 PM
                    2 responses
                    14 views
                    0 likes
                    Last Post Pattontje  
                    Started by flybuzz, 04-21-2024, 04:07 PM
                    17 responses
                    229 views
                    0 likes
                    Last Post TradingLoss  
                    Started by agclub, 04-21-2024, 08:57 PM
                    3 responses
                    17 views
                    0 likes
                    Last Post TradingLoss  
                    Started by TradingLoss, 04-21-2024, 04:32 PM
                    4 responses
                    43 views
                    2 likes
                    Last Post TradingLoss  
                    Started by cre8able, 04-17-2024, 04:16 PM
                    6 responses
                    56 views
                    0 likes
                    Last Post cre8able  
                    Working...
                    X