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 algospoke, 05-13-2024, 06:53 PM
            4 responses
            28 views
            0 likes
            Last Post algospoke  
            Started by dtl-saw, 12-29-2022, 09:12 AM
            46 responses
            3,182 views
            1 like
            Last Post sonia0101  
            Started by AlphaOptions, 06-18-2013, 08:24 AM
            7 responses
            2,186 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by FAQtrader, 04-25-2024, 12:00 PM
            14 responses
            215 views
            0 likes
            Last Post sonia0101  
            Started by bsbisme, Today, 05:08 PM
            0 responses
            10 views
            0 likes
            Last Post bsbisme
            by bsbisme
             
            Working...
            X