Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limiting a Plot

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

    Limiting a Plot

    Hi,

    Is there a way I can limit the plot of say an SMA to display for just the last 20 bars of the chart?

    If so, would someone please post some sample code that would allow this.

    Thankyou.

    #2
    This is not supported by default. There probably is a way to custom code it in NinjaScript, but unfortunately we don't have a sample a hand.

    Comment


      #3
      rt-trader you can add this code at the start of the OnBarUpdate() section of the indicator code as a simple workaround. Now this code does not completely do what you are trying to achieve because it does not automatically remove old plotted points. If you hit F5 and refresh the chart it will remove old points though.
      Code:
      BarsRequired = Bars.Count-20;
      Edit: To achieve the exact behavior you wanted please check out the reference sample I have added. The magic is done in the Plot Override section. Basically what is happening is I am creating a Path object that traces only the SMA value for the last 20 bars. Then I tell it to draw that path and voila you have an indicator that only draws for the last 20 bars.
      Attached Files
      Last edited by NinjaTrader_JoshP; 08-25-2007, 06:55 PM.
      Josh P.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, Yesterday, 04:31 AM
      0 responses
      33 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      286 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      284 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      133 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      91 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X