![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
|
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...
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the reply. Boy am I excited for NT7.
|
|
|
|
|
|
#4 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
|
Ok, please do and we have a look later, thanks
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
|
Please try changing Initialize() to -
Code:
Add(new Line(Color.FromKnownColor(KnownColor.Black), HighTreshold, "Overbought")); Add(new Line(Color.FromKnownColor(KnownColor.Black), LowTreshold, "Oversold")); 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)); }
}
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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")); |
|
|
|
|
|
#11 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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")); |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,563
Thanks: 261
Thanked 1,015 times in 996 posts
|
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)); }
}
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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! |
|
|
|
|
|
#14 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Member
Join Date: Aug 2009
Posts: 38
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |