NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 10-06-2009, 10:59 AM   #1
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default Autoscale for oscilators, not just drawings...

Is there a way to turn autoscale off for oscillators that draw 0-100 values?

I don't mean the autoscale property for drawings on panels. I mean that if I have an oscillator that could range from 0-100 but it's currently always above 60, for example, then 60 becomes the bottom edge of the graph and you have no sense of context. I'd like to see all that blank space from 0 to 60 with the plot over the halfway point in the visual space.

Make sense? How do I do that?
noevictorian is offline  
Reply With Quote
Old 10-06-2009, 11:07 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
Default

noevictorian, unfortunately changing the scale is not supported in NinjaTrader 6.5, however our upcoming version 7 would offer more options in this regard.

NinjaTrader 6.5 would scale this dynamically depending on the visible portion on your current osc / chart view...
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 10-06-2009, 11:11 AM   #3
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the reply. Boy am I excited for NT7.
noevictorian is offline  
Reply With Quote
Old 10-06-2009, 11:18 AM   #4
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Can I ask you another question without starting a new thread for it. I've searched the forum and must be using the wrong search terms because I can't imagine it hasn't been asked and answered:

Can I reference the level of a specific line in a statement? For example I have overbought/oversold lines at 30 and 70... if a user changes these to 90 and 10 in the line configuration settings of the indicator, can I then reference their custom values in logic like this:

if plot[0] > theirCustomLineValue
Print("over the line");

right now I'm hardcoding my if logic but when they change it my logic doesn't match their chart. If they change the line to 90 and my logic is hardcoded:

if plot[0] > 70
Print("over the line");

It's wrong.

Suggestions? Or should I start a new thread to help others searching for this topic?
noevictorian is offline  
Reply With Quote
Old 10-06-2009, 11:22 AM   #5
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
Default

You would just need to define a user defined input level for this custom line, then it would work and be 'picked up' - http://www.ninjatrader-support2.com/...ead.php?t=5782
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 10-06-2009, 11:23 AM   #6
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks, Josh. I've basically done that. Maybe I should post my code. When I'm back at my desk I'll do just that. Because, yeah I thought it would be that easy but it's not working so I'm clearly screwing something obvious up.

Thanks
noevictorian is offline  
Reply With Quote
Old 10-06-2009, 11:26 AM   #7
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
Default

Ok, please do and we have a look later, thanks
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 10-07-2009, 08:24 AM   #8
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Okay, so here's the code I'm using...

In the Properties section I define my public int's:

[Description("Defines the upper threshold line.")]
[Category("Lines")]
public int Overbought
{
get { return HighThreshold; }
set { HighThreshold = Math.Max(50, value); }
}

[Description("Defines the lower threshold line.")]
[Category("Lines")]
public int Oversold
{
get { return LowThreshold; }
set { LowThreshold = Math.Max(1, Math.Min(49,value)); }
}


In the Variables section I define the variables they reference:

private int HighThreshold = 60; // The level of the overbought line
private int LowThreshold = 40; // The level of the oversold line

In the Initialize section I draw the lines:

Add(new Line(Color.FromKnownColor(KnownColor.Black), Overbought, "Overbought"));
Add(new Line(Color.FromKnownColor(KnownColor.Black), Oversold, "Oversold"));

But I must be doing something wrong. Do you see any errors?
noevictorian is offline  
Reply With Quote
Old 10-07-2009, 08:42 AM   #9
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
Default

Please try changing Initialize() to -

Code:
Add(new Line(Color.FromKnownColor(KnownColor.Black), HighTreshold, "Overbought"));
Add(new Line(Color.FromKnownColor(KnownColor.Black), LowTreshold, "Oversold"));
In the Properties -

Code:
 
[Description("Defines the upper threshold line.")]
[Category("Lines")]
public int HighTreshold
{
get { return highThreshold; }
set { highThreshold = Math.Max(50, value); }
}

[Description("Defines the lower threshold line.")]
[Category("Lines")]
public int LowTreshold
{
get { return lowThreshold; }
set { lowThreshold = Math.Max(1, Math.Min(49,value)); }
}
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 10-07-2009, 08:47 AM   #10
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Doing that gives me a "does not exist in the current context" error.

Do you mean this:

Add(new Line(Color.FromKnownColor(KnownColor.Black), HighTreshold, "Overbought"));
Add(new Line(Color.FromKnownColor(KnownColor.Black), LowTreshold, "Oversold"));
noevictorian is offline  
Reply With Quote
Old 10-07-2009, 08:48 AM   #11
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Sorry forgot to change that last post... I meant this:

Add(new Line(Color.FromKnownColor(KnownColor.Black), highTreshold, "Overbought"));
Add(new Line(Color.FromKnownColor(KnownColor.Black), lowTreshold, "Oversold"));
noevictorian is offline  
Reply With Quote
Old 10-07-2009, 08:52 AM   #12
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
Default

No, sorry I think my spelling was off causing this -

Code:
 
[Description("Defines the upper threshold line.")]
[Category("Lines")]
public int HighThreshold
{
get { return highThreshold; }
set { highThreshold = Math.Max(50, value); }
}

[Description("Defines the lower threshold line.")]
[Category("Lines")]
public int LowThreshold
{
get { return lowThreshold; }
set { lowThreshold = Math.Max(1, Math.Min(49,value)); }
}
NinjaTrader_Bertrand is online now  
Reply With Quote
Old 10-07-2009, 09:06 AM   #13
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Bertrand, I really appreciate the help on this. I'm at a loss. I've attached my code to this post. That might be the fastest way to see what I'm messing up.

Incidentally, this current problem version also demonstrates something i posted about yesterday. If you change the value of one of the Overbought/Oversold lines they don't move (which is this current problem) but also the y axis disappears (which I saw yesterday too). Solving the current problem may remedy that erroneous axis behavior, though.

Thanks!
Attached Files
File Type: zip Code_problem.zip (9.0 KB, 2 views)
noevictorian is offline  
Reply With Quote
Old 10-07-2009, 09:19 AM   #14
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

noevictorian,

You exported your file as a compiled assembly which means we cannot see the code. Please do it as source files for us to be able to view. Thank you.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-07-2009, 09:29 AM   #15
noevictorian
Member
 
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
Default

Sorry Josh. Source should be attached here.

One area to look into... I've got LinesConfigurable set to false because I don't want to give access to the Lines in two ways: via my property and manually. But maybe that's throwing things off?
Attached Files
File Type: zip Code_problem.zip (4.9 KB, 3 views)
noevictorian 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
Saving charts drawings yuvalw Suggestions And Feedback 7 07-19-2010 03:50 AM
Back Testing Strategy - Drawings Don't Show Ranger Strategy Analyzer 6 03-12-2009 10:08 AM
Line drawings get cut off trader_rick1234 Charting 5 02-05-2009 07:46 AM
Saving Drawings On Charts? cbratton Charting 4 02-01-2009 11:35 AM
Ability to lock drawings on chart VagyokC4 Suggestions And Feedback 1 09-22-2007 03:53 AM


All times are GMT -6. The time now is 05:11 AM.