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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        162 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X