NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 02-24-2011, 01:09 PM   #1
denhu fazu
Junior Member
 
Join Date: Dec 2010
Posts: 8
Thanks: 0
Thanked 0 times in 0 posts
Default 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.
denhu fazu is offline  
Reply With Quote
Old 02-24-2011, 01:17 PM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hello denhu fazu,

You can work with Count in relation to CurrentBar for this.

if (Count - CurrentBar <= 60)
Plot0.Set(Close[0]);
NinjaTrader_RyanM is offline  
Reply With Quote
Old 02-24-2011, 03:20 PM   #3
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,214
Thanks: 24
Thanked 1,229 times in 1,000 posts
Send a message via Skype™ to koganam
Default

Quote:
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);
koganam is online now  
Reply With Quote
Old 02-24-2011, 03:28 PM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Thanks for the additional tip, Koganam.
NinjaTrader_RyanM is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does Vol indicator Not plot first 20 bars? zacharydw00 Version 7 Beta General Questions & Bug Reports 5 11-01-2010 09:43 AM
Bars information in custom plot supernatural Version 7 Beta General Questions & Bug Reports 4 09-05-2010 12:45 PM
Buy/Sell volume - can I plot two bars? Day Trading Fool Indicator Development 1 07-12-2010 04:46 PM
accessing plot value of previous bars shooter General Programming 2 04-20-2009 11:17 PM
How to plot text (outside of bars) richard Indicator Development 1 06-07-2006 08:31 PM


All times are GMT -6. The time now is 07:49 PM.