Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change DrawingTool Template via c#

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

    Change DrawingTool Template via c#

    Hi, is it possible to change the DrawingTool template via script? Currently, the rectangle is started to draw with the default template. When it is finished drawing, the stroke is changed via eventhandler. I would like to change the stroke already when it has started to draw and not when the drawing process is complete.

    I have made a short vid: http://www.youtube.com/watch?v=WUJHHXzBTx4
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Drawing tools included with NinjaTrader have an overload for specifying the template name string.

    Draw.Rectangle(NinjaScriptBase owner, string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)
    https://ninjatrader.com/support/help..._rectangle.htm

    Or you can change the default template for that drawing tool so every new drawing object uses the default template.
    Last edited by NinjaTrader_ChelseaB; 01-09-2022, 12:28 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi _ChelseaB, I don't draw by indicator or strategy, but manually via DrawingTool. Your help doesn't seem to really help me ;-) I should be able to change the template via script without working with the Draw.Rectangle, because I create the drawing manually in the chart, just like in the video.
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        The template can only be applied with calling a Draw method as the object is created. Once it exists you can change specific properties as listed in the help guide, but you cannot apply a template.

        When manually clicking a drawing tool, the template saved as Default will automatically be applied.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi _ChelseaB, aha thanks for the explanation!
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment


            #6
            Can you point to the method beyond the change template action (load template) ?

            Comment


              #7
              Hello MecuSorin,

              Welcome to the NinjaTrader forums!

              There is not a method to change a template, but you can remove a drawing object and redraw it with a template.

              When calling a Draw method there is an overload to specify a template by name.

              Draw.Dot(NinjaScriptBase owner, string tag, bool isAutoScale, int barsAgo, double y, bool isGlobal, string templateName)

              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks for the feedback, but that doesn't answer my question. There is a method that have that functionality behind the UI actions. Cannot delete the user drawn controls. Some "container|owner|manager" is invoking the save template, load template functions. I just want a way to dynamically invoke that functionality (of loading a different template).

                Comment


                  #9
                  Hello MecuSorin,

                  Unfortunately, there is nothing exposed in NinjaScript for this.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  581 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  338 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  554 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  552 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X