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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        169 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        324 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        250 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        353 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        180 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X