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() 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 timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        40 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Working...
        X