Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot removal

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

    Plot removal

    I need to remove part of the past indicator plot and redraw it differently in code. How can I remove only a portion of a plot 2 bars ago?

    Afshin

    #2
    Hello,

    The DataSeries.Set() method has a bars ago argument you can use,

    .Set(int barsAgo, double value)

    So under whatever condition you want to redraw the plot, you can .Set(2, myNewValue); where this will update the plot 2 bars ago with your new value.
    MatthewNinjaTrader Product Management

    Comment


      #3
      I am using .Set with BarsAgo and it works as expected. what I need is to remove what .Set has plotted during the previous bar and redraw it. I need something equivalent to RemoveDrawObject() but for .Set - Is this possible?

      Comment


        #4
        There is not a method equivalent to ReoveDrawObject() for the plots. If it works for your indicator, you could switch to drawing objects and then use RemoveDrawObject()

        If you must use a Plot(), you can look at the Swing indicator which replots based off of a specific condition:

        Code:
        				if (High[0] > High[strength] && swingHighSwings[strength] > 0.0)
        				{
        					swingHighSwings.Set(strength, 0.0);
        					for (int i=0; i<=strength; i++)
        						SwingHighPlot.Reset(i);
        					currentSwingHigh = 0.0;
        				}
        				else if (High[0] > High[strength] && currentSwingHigh != 0.0)
        				{
        					SwingHighPlot.Reset();
        					currentSwingHigh = 0.0;
        				}
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by afshinmoshrefi View Post
          I am using .Set with BarsAgo and it works as expected. what I need is to remove what .Set has plotted during the previous bar and redraw it. I need something equivalent to RemoveDrawObject() but for .Set - Is this possible?
          Code:
          PlotName.Reset(barsAgo);

          Comment


            #6
            Worked like a charm. Thanks

            Comment

            Latest Posts

            Collapse

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