Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't dispose of Stroke object

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

    Can't dispose of Stroke object

    Hello,
    I created a new Sroke object, setting width to 5. I deleted the command later, but the Draw.Dot method draws large points now no matter what I do. I do not remember exactly what object I created. I guess, it was smth like Stroke a = new Stroke(Brushes.Red, 5); How can I reset the Stroke, or dispose of that object?
    Thanks.

    #2
    Hello Lucero,

    Thanks for writing in.

    You can set the Stroke you created to null when you are done with it and no longer wish to use the Stroke.

    As for removing the drawing object, you may wish to look into RemoveDrawObject() and RemoveDrawObjects(). RemoveDrawObject() removes that drawing objects based on tag, and RemoveDrawObjects() removes all drawing objects from the indicator or strategy.

    Please see the documentation below for more information and sample code:


    If you have any other questions, please don't hesitate to ask.

    Comment


      #3
      The object is no longer in the code, I deleted it long ago, how can I set it to null? The problem is that the Draw.Dot() does not plot a 1 pixel dot, instead it plots a circle 10 pixels in diameter. How can I make it draw a 1 pixel point again?

      Comment


        #4
        Hello Lucero,

        Thanks for the clarification.

        The Draw.Dot() method creates a dot with the size specified by the chart's bar width.

        Tip: The size of the dot is tied to the chart's BarWidth and thus will scale automatically as the chart is resized


        If you wish to make drawing objects that are the size of one pixel, you may have more flexibility using Draw.Line() so you can specify an exact width. You may wish to also investigate using GetTimeByX() and the advanced features used with OnRender() to work with the Draw.Line() to create an object being one pixel in width.

        Documentation can be found below:
        Draw.Line() - https://ninjatrader.com/support/help.../draw_line.htm
        GetTimeByX() - https://ninjatrader.com/support/help...gettimebyx.htm
        OnRender() - https://ninjatrader.com/support/help...e_onrender.htm

        Please let me know if we may be of further help.

        Comment


          #5
          The bar width is set to 1, and still Draw.Dot(this, LineNumber.ToString()+" Start", true, xStart , TickSize * yStart, Brushes.Brown); draws circles instead of dots. I even created a different indicator consisting of a single line Draw.Dot(this, "1", true, 0 , Close[0], Brushes.Brown); and it also draws the same circle no matter if IsAutoscale is set to true or false or what color is set.
          Attached Files

          Comment


            #6
            Hello Lucero,

            Thanks for pointing that out.

            The Draw.Dot() drawing object will keep fixed minimum size, but scales with the chart as you increase the margin.

            If you would like, I can place a feature request for the development team to add another overload for allowing the Draw.Dot() method to override the minimum size.

            Please let me know if we may be of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            599 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            345 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
            558 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            558 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X