Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding a Button to a Chart to Interact with a Strategy

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

    Adding a Button to a Chart to Interact with a Strategy

    I found this sample:

    https://ninjatrader.com/support/help...collection.htm

    if I add a button to the chart, how can I get it to interact with 1 or 2 more strategies that are running on the chart?

    I haven't really thought it through but I guess I would want to set a flag or enum within the Strategy once the button is clicked.

    note: Regular Strategy, not ATM Strategy

    #2
    Hello NinjaCustomer,

    Thanks for your post.

    Buttons would be added from a specific NinjaScript and would only have control over that NinjaScript. You could consider to have the button set a static variable that resides in the AddOn namespace and then have your strategies take an action checking that bool in their OnBarUpdate methods. An example for sharing information between NinjaScripts taking this approach can be found below.



    We look forward to being of further assistance.

    Comment


      #3
      what type of NinjaScript should I use to create the Buttons? an Indicator?

      I assume it is not possible to create them from within a Strategy (although that would be ideal if possible)

      Comment


        #4
        Hello NinjaCustomer,

        An indicator or strategy can add buttons to a chart. An example for adding buttons to a strategy can be found below.



        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

        ​​​​​​​Please let us know if there is anything else we can do to help.

        Comment


          #5
          Hi Jim, so just to confirm - if I make a Strategy that adds buttons to the chart then I don't need to deal with the hassle of the "AddOn namespace" ? I can just set a flag within the Strategy itself?

          Comment


            #6
            Hello NinjaCustomer,

            The example strategy adds buttons that will only work in the scope of that strategy. If you would like to have the buttons work across multiple strategies, then the buttons would have to modify static variables in the AddOn namespace and each strategy will have to read these static variables to take a certain action.

            Please let me know if you have any additional questions.

            Comment


              #7
              Note To Self: https://ninjatrader.com/support/foru...rategy?t=98716

              Comment


                #8
                In this post, there is a reference to:

                https://ninjatrader.com/support/help...collection.htm

                I have downloaded this file and added it to a chart. But when I tried to test it during Playback I can't enable it.
                Is there a reason I can't test this Button add on in Playback?

                regards,
                Taddypole

                Comment


                  #9
                  Hello Taddypole,

                  Please make sure there is data on that instrument, and please ensure that the Playback account is selected when testing the strategy. I suggest opening a new chart and enabling the strategy on the new chart to ensure the data is there and that you can select the proper account.

                  We look forward to assisting.

                  Comment


                    #10
                    For some reason, I have to remove the strategy and then re-apply it. Then it works.

                    Comment


                      #11
                      is there an indicator that places a button on the chart ,that can be seen in strategy builder to set as a condition if the button was pressed (say it should have the value "1" )

                      Comment


                        #12
                        Hello yBl123,

                        Thanks for your notes.

                        I am not aware of any existing indicators that accomplish this specifically.

                        You could try browsing the NinjaTrader Ecosystem User App Share for a possible solution.

                        Ecosystem User App Share: https://ninjatraderecosystem.com/user-app-share/

                        This forum thread will also be open for other community members to share their insights on the topic.


                        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
                        <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

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        633 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        364 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        105 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        567 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        568 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X