Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot() on last N bars

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

    Plot() on last N bars

    Hello,
    (1) I've done the following :

    Add(new Plot(new Pen(Color.Red, 1), PlotStyle.Line, "hh"));
    Plots[0].Pen.DashStyle = DashStyle.Dash;

    (2) How could I have the PLOT() just to plot from the last N bars like what I've done with :

    DrawLine("c02", true, 60, hh+TickSize*20, 0, hh+TickSize*20, Color.Silver, DashStyle.Dash, 1);

    Thanks.

    #2
    Hello denhu fazu,

    You can work with Count in relation to CurrentBar for this.

    if (Count - CurrentBar <= 60)
    Plot0.Set(Close[0]);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by denhu fazu View Post
      Hello,
      (1) I've done the following :

      Add(new Plot(new Pen(Color.Red, 1), PlotStyle.Line, "hh"));
      Plots[0].Pen.DashStyle = DashStyle.Dash;

      (2) How could I have the PLOT() just to plot from the last N bars like what I've done with :

      DrawLine("c02", true, 60, hh+TickSize*20, 0, hh+TickSize*20, Color.Silver, DashStyle.Dash, 1);

      Thanks.
      You will have to reset the Plot N bars ago so that it is removed from the chart on a running basis.

      Code:
      Values[0].Reset(N);

      Comment


        #4
        Thanks for the additional tip, Koganam.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        601 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        347 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
        559 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