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 06-01-2010, 02:36 AM   #1
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 4 times in 4 posts
Default I can't get this line to plot. What am I missing?

I can get values but I can't plot this line. Code is below:-

Code:

protectedoverridevoid Initialize()
{
Add(new Plot(Color.Magenta, PlotStyle.Line, "PlotA"));
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = false;
myDataSeries = new DataSeries(this);
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar < 3) return;
 
myDataSeries.Set(Math.Min(Low[1],Close[2]));
Print("true low is" + myDataSeries.ToString());
 
 
}
kaywai is offline  
Reply With Quote
Old 06-01-2010, 05:27 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,384
Thanks: 252
Thanked 967 times in 950 posts
Default

Kay, you never plot this series - does it give you any prints?

Try for example - PlotA.Set(Math.Min(Low[1],Close[2]));

or

Value.Set(Math.Min(Low[1],Close[2]));
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 06-01-2010, 08:25 AM   #3
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 4 times in 4 posts
Default

Hi Bertrand,

I get an error message "The name 'PlotA' does not exist in the current context but when i use Value.Set it works!

Why is that the case?
Last edited by kaywai; 06-01-2010 at 08:28 AM. Reason: adding more information
kaywai is offline  
Reply With Quote
Old 06-01-2010, 09:01 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,384
Thanks: 252
Thanked 967 times in 950 posts
Default

Great, then please check how you named your public DataSeries to be associated with your Plot in the Properties section of the code and adjust my snippet then as needed.
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 06-01-2010, 09:20 AM   #5
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 4 times in 4 posts
Default

sorry betrand. what am i suppose to put in the properties section?
kaywai is offline  
Reply With Quote
Old 06-01-2010, 09:22 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,384
Thanks: 252
Thanked 967 times in 950 posts
Default

You would need to expand the properties section of your code and see how the public DataSeries associated with your Plot is named, as then reflect this properly in your snippet code. As an example check into our BollingerBands indicator and see how Upper, Lower and Middle work codewise.
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 06-01-2010, 09:23 AM   #7
kaywai
Senior Member
 
Join Date: Sep 2009
Posts: 562
Thanks: 40
Thanked 4 times in 4 posts
Default

issue resolved. thx for the pointers bertrand!
kaywai 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
Trying to Plot Line in Strategy yamdigger Strategy Development 2 05-27-2009 11:17 AM
Plot horizontal line ssg10 General Programming 1 05-13-2009 05:54 AM
Line Plot velocity General Programming 10 05-07-2009 05:59 AM
Missing line part tagomi Indicator Development 2 09-03-2008 08:44 AM
Plot a line of the bar close dryan_uk General Programming 1 06-09-2008 11:44 AM


All times are GMT -6. The time now is 04:25 PM.