Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start strategy in ninjascript not on a chart

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

    Start strategy in ninjascript not on a chart

    Hello!

    I was wondering if there was a way to programmatically start a strategy, say from an AddOn? Even if it was just to add it to the Control Center's Strategies tab and enable it? I trade with multiple accounts and would like to not have a ton of charts open with my strategies enabled on each one. Ideally, I'd like to work on an AddOn that allows for multiple strategies to be enabled on different accounts and instruments and submitting orders via a selected ATM strategy. I know how to do some of this, but a big piece that's missing is a method for starting a Strategy within Ninjascript.

    Thank you for your time!

    #2
    Hello Calandestron,

    Thanks for your post.

    There are no supported methods or functions available for programmatically starting a strategy using code/NinjaScript.

    The strategy would need to be manually added and enabled.

    I have added a vote for you to a current feature request for the ability to programmatically start a strategy in NinjaScript. This request is being tracked under the number SFT-2844.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

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

    Please let us know if we may be of further assistance to you.​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi Brandon,

      Okay, thanks for adding my vote and for your response!

      Cal

      Comment


        #4
        Please add my vote to support SFT-2844.

        Comment


          #5
          Hello drsclaud23,

          Thanks for your note.

          Your vote has been added to this feature request.

          Please let me know if I may further assist.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment


            #6
            Please add my vote for this feature.

            Comment


              #7
              Hello Mindset,

              I have added your vote to this feature request.

              Please let me know if you have further questions on this.
              <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

              Comment


                #8
                Hi guys,
                I was able to solve this matter using one of two methods:
                Solution 1. Into the relevant section of the code (in my case it was State.Realtime) add the following:
                a. PC mouse click command (used ChatGPT to help) - used library System.Windows.Automation, which you would have to add as a reference to your script.
                b. Right after (line after) terminate the strategy: SetState(State.Terminated);
                c. After running the strategy keep the mouse cursor on the strategy enabling checkbox (alternatively, add a command to move the mouse to the checkbox coordinates before step "a").

                This one would work pretty well most of the time and will self-restart (but sometimes it won't trigger, as it depends on the speed of the mouse click effect on the strategy enablement vs. the shutting off the strategy)

                Solution 2. Adding a Power Automate to create a stable result. Steps:
                a. Download a free standalone Power Automate version.
                b. Create an automation that (in this order):
                1. Selects the "Strategies" tab in Ninja
                2. Checks the enable strategy checkbox
                3. Selects Power Automate app window to make it active (you must switch it back from NT to Power Automate).
                4. Places the mouse cursor on top of the "Run" button
                c. Use the 1st solution with a slight adjustment:
                a. Keep step "a" and "b"

                This would work just fine, no need to add a wait time or a delay between the enablement of the Power Automate automation and the termination of the NT strategy, as it would take Power Automate a few seconds to start the automation (the NT would be terminated by then).

                Feel free to raise any issues, I'll try to help
                Last edited by DimaFridrich; 06-03-2023, 04:30 AM.

                Comment


                  #9
                  I agree this should be an NT feature to control a strategy in a straightforward way. Auto-ITing it means it takes over the mouse and takes time and is subject to failure if anything goes wrong e.g. the user clicks on anything - for all we know the user might have been busy typing and working when the add-on decides to add the strategy.
                  Bruce DeVault
                  QuantKey Trading Vendor Services
                  NinjaTrader Ecosystem Vendor - QuantKey

                  Comment


                    #10
                    Please add my vote for this feature.

                    Comment


                      #11
                      Your vote has been added.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      65 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      139 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      75 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      45 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      50 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X