Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to start a custom drawing tool from a button?

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

    #16
    Hello codeowl,

    Thank you for your patience while we looked into this matter.

    To break this down drawing tools were not designed to work from an Add On windows call to the chart. So the functions we are trying here would not be supported:
    • Calling a drawing tool from the Add On
    • Controlling Snap Mode and receiving and displaying updates on Snap Mode from the chart
    • Changing display of an Add On item (such as button) based on the Drawing State
    • Access to drawing events in Add On
    • Collecting drawing objects to see if the Add On drew them, removed, changed, or copied them

    Comment


      #17
      Hi Patrick

      When you say, '...would not be supported', do you mean that starting a custom drawing tool from a button is just not possible, or that NT won't support someone trying to code it?

      Comment


        #18
        Hello FatCanary,

        Thank you for your response.

        We would provide support on the matter to the extent possible. The Add Ons were not meant to call the Drawing Objects and using a custom button in another window such as an Add On to call a drawing object is not supported.

        Comment


          #19
          Thanks Patrick.

          I may be missing the point, but what about calling a custom drawing tool from a custom button on the chart toolbar, not from another window?

          Comment


            #20
            Hello FatCanary,

            Thank you for your patience.

            You can call the drawing objects from buttons to execute. For example:
            Code:
            NinjaTrader.Gui.Chart.ChartDrawingToolCommands.Line.Execute(this); // would start a Line drawing tool to draw

            Comment


              #21
              Yes, but as codeowl pointed out, when trying this with a custom drawing tool that method doesn't work.

              From codeowl:
              Following your example I have been able to start an existing drawing tool. However, I have written a custom drawing tool so there is no command for it in:
              Code:
              NinjaTrader.Gui.Chart.ChartDrawingToolCommands
              I tried just creating my own static class and added a command for the tool:
              Code:
              public static class MyCommands
              {
                  public static ICommand MyCustomDrawingTool;
              }
              But when I run the MyCustomDrawingTool.Execute(this) method, it gives the error:
              Object reference not set to an instance of an object.

              So how can I start a "custom" Drawing Tool that I have created, from a button?
              codeowl


              Regards.
              FatCanary

              Comment


                #22
                Hello FatCanary,

                Thank you for the clarification.

                There would not be a means to do so in NinjaScript with a custom drawing tool.

                Comment


                  #23
                  That's a shame, but thanks for confirming.

                  Comment


                    #24
                    FYI, my AddOn is not in a separate window, it is docked in the same window as the chart like the Chart Trader is.

                    Regards,

                    codeowl

                    Comment


                      #25
                      If it hasn't been done so already could this be added as a feature request. I've had requests to integrate custom draw tools into their custom indicator menus

                      Feature Request: Would like there to be a way to have a custom drawing tool be selected from a custom drop down menu generated from an indicator

                      Comment


                        #26
                        Patrick,

                        The following issues/questions were not covered in your previous post. Can you answer these for me please.

                        Issues:
                        • No way to delete a User Drawn DrawObject from the chart.(2)
                        • No way for the end user to modify drawnings created from code. (3)
                        • No way to add an indicator to a chart with code. (4)


                        Questions:
                        • Is there a way to programmaticly select a specific drawing on the chart?
                        • Is there a way to programmaticly scroll a specific drawing into view?
                        • I found that I can get a drawing created from code to appear straight away if I call: _Indicator.ForceRefresh(); Not sure this is the best approach. Please let me know if there is a better way of doing it.


                        Additional Notes:
                        (2) I have created a custom drawing tool to allow the user to collect data from the chart and send it to the Add-on. However when changing functions in the Add-on I need to be able to remove the drawings.

                        (3) I want the user to be able to load in a list of previos selections and edit them. This can't be done as you can't modify drawings created from code.

                        (4) Having to use an indicator to add a drawing on a chart, and detect when it is removed, means that I need to create an indicator that has no other purpose than this. Eg; id does not plot any lines on the chart or give the end user any value. Yet due to the inability to add an indicator to the chart via code, the end user is forced to add the indicator themselfs, for no perceivable benifite, other than the AddOn won't work without it.

                        Regards,

                        codeowl

                        Comment


                          #27
                          Hello codeowl,

                          Thank you for your response.
                          • User drawn objects cannot be removed via NinjaScript.
                          • Users can alter drawn objects from code. You would set the IsLocked bool to false: http://ninjatrader.com/support/helpG...rawingtool.htm
                          • There would not be a means to add an indicator to the chart via code other than AddChartindicator() through a strategy.


                          I will forward your items to development as suggestions for possible implementation in a later release of NinjaTrader.

                          Comment


                            #28
                            Patrick,

                            Thanks for following up, and submitting feature requests, much appreciated.

                            Regards,

                            codeowl

                            Comment


                              #29
                              Hello codeowl,

                              The following items have been assigned internal tracking ids:
                              • Delete user drawn drawing tool: ID # SFT-1444
                              • Add an indicator to a chart through an Add On: ID # SFT-1445
                              • Set Z-Order for a drawn object on the chart: ID # SFT-1016

                              Comment


                                #30
                                Patrick,

                                Thanks for the update mate ;-)

                                Regards,

                                codeowl

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                666 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                377 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                110 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                575 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                580 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X