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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        475 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        316 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        253 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        340 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        305 views
        0 likes
        Last Post CarlTrading  
        Working...
        X