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

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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        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.
            JimNinjaTrader Customer Service

            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.
                  JimNinjaTrader Customer Service

                  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.
                        Brandon H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Aviram Y, Today, 05:29 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post Aviram Y  
                        Started by quantismo, 04-17-2024, 05:13 PM
                        3 responses
                        25 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by ScottWalsh, 04-16-2024, 04:29 PM
                        7 responses
                        34 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by cls71, Today, 04:45 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post cls71
                        by cls71
                         
                        Started by mjairg, 07-20-2023, 11:57 PM
                        3 responses
                        216 views
                        1 like
                        Last Post PaulMohn  
                        Working...
                        X