NinjaTrader Support Forum  

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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 04-17-2009, 06:07 AM   #1
velocity
Senior Member
 
Join Date: Dec 2007
Posts: 314
Thanks: 0
Thanked 0 times in 0 posts
Default Line Plot

I am trying to plot a constant line at 3 and -3 on a panel. this is what I have:

Add(new Plot(Color.Transparent, PlotStyle.Line, "Plot8")); // Plot 8
Add(new Plot(Color.Transparent, PlotStyle.Line, "Plot9")); // Plot 9
Plot8.Set(3); // Make Oscillator Scale constant at 3 on average
Plot9.Set(-3); // Make Oscillator Scale constant at -3 on average

I keep getting an error that:

The name Plot8 does not exist in the current context
The name Plot9 does not exist in the current context

Where am I going wrong?

velocity is offline  
Reply With Quote
Old 04-17-2009, 06:25 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Hi velocity, are the associated dataseries added in the properties for Plot8 and Plot9?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 04-17-2009, 06:45 AM   #3
velocity
Senior Member
 
Join Date: Dec 2007
Posts: 314
Thanks: 0
Thanked 0 times in 0 posts
Default

i added the following

[Browsable(false)]
[XmlIgnore()]
public DataSeries Plot8
{
get { return Values[8]; }
}

[Browsable(
false)]
[XmlIgnore()]
public DataSeries Plot9
{
get { return Values[9]; }
}

But, it does not work. the scale will go to +1/-1 if the oscillator's values are between +1 and -1. However I want the scale to be +3 amd -3 even if the values are between +1 and -1

Any thoughts as to where I am going wrong?
velocity is offline  
Reply With Quote
Old 04-17-2009, 07:41 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Hi velocity, unfortunately changing the scale is not supported at this time - have you tried working with Min and Max as in this tutorial?http://www.ninjatrader-support.com/H...ionLogic3.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 04-17-2009, 07:47 AM   #5
velocity
Senior Member
 
Join Date: Dec 2007
Posts: 314
Thanks: 0
Thanked 0 times in 0 posts
Default

that is what i thought too. However, if I place a constant value as an idicator and make it transparent, I was trying to fake NT out so the scale would adjust.

Any thoughts?
velocity is offline  
Reply With Quote
Old 04-17-2009, 07:58 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

velocity,

Not supported at this point in time. If you want to "fake" it out, don't use a transparent color.
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-17-2009, 08:12 AM   #7
velocity
Senior Member
 
Join Date: Dec 2007
Posts: 314
Thanks: 0
Thanked 0 times in 0 posts
Default

OK. I changed everything to the following and now I do not get any plots, what's wrong here?

Add(new Plot(Color.Black, PlotStyle.Line, "Plot8")); // Plot 8
Add(new Plot(Color.Black, PlotStyle.Line, "Plot9")); // Plot 9
Plot8.Set(3); // Make Oscillator Scale constant at 3 on average
Plot9.Set(-3); // Make Oscillator Scale constant at -3 on average
Plots[8].Max = 3;
Plots[
9].Min =-3;
velocity is offline  
Reply With Quote
Old 04-17-2009, 08:48 AM   #8
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Don't set your plots inside Initialize(). Do it inside OnBarUpdate().
NinjaTrader_Josh is offline  
Reply With Quote
Old 04-17-2009, 10:21 AM   #9
velocity
Senior Member
 
Join Date: Dec 2007
Posts: 314
Thanks: 0
Thanked 0 times in 0 posts
Default

that did it, thank you
velocity is offline  
Reply With Quote
Old 05-07-2009, 01:18 AM   #10
noincomenojobnoassets
Senior Member
 
Join Date: Mar 2009
Posts: 109
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi,

A similar question from me:

In my strategy Initialize() section, I have included

Add(Stochastics(7,14,3))

in the code.

When running the strategy, the stochastics panel appears as desired; however, it has the "standard" channel lines at 20 and 80. How do I change those values to 30 and 70, for example? Something like

Add(Stochastics(7,14,3),UpLine = 70,DownLine = 30) would be great...

Thanks for helping!
noincomenojobnoassets is offline  
Reply With Quote
Old 05-07-2009, 05:59 AM   #11
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
Default

Unfortunately this is not possible without custom coding, as you can only Add() full indicators, not specific plots of indicators.
NinjaTrader_Bertrand 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
Problems learning to change line plot color & draw arrows once only cclsys Indicator Development 39 03-29-2009 03:00 PM
Plot Line Length ozfader General Programming 3 07-12-2008 11:39 PM
Plot a line of the bar close dryan_uk General Programming 1 06-09-2008 11:44 AM
Plot an Horizontal line on chart with value from a strategy skynetman General Programming 5 05-01-2008 01:30 PM
line plot mathematics? Burga1 General Programming 0 04-14-2008 10:18 PM


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