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

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 aa731, Today, 02:54 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by BarzTrading, Today, 07:25 AM
            0 responses
            3 views
            0 likes
            Last Post BarzTrading  
            Started by i019945nj, 12-14-2023, 06:41 AM
            5 responses
            65 views
            0 likes
            Last Post i019945nj  
            Started by ruudawakening, Today, 12:58 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by thread, Yesterday, 11:58 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X