Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Accessing Hidden Indicator Conditions
Collapse
X
-
Josh you're being too vague. All I'm trying to do is access an indicator's true condition from the strategy wizard. I don't mind changing the code of the indicator but I want to be able to access that code from the strategy wizard. Either you can tell me how to do this or not.
-
Where exactly do you need clarification on? You cannot access true/false BoolSeries of an indicator from the Strategy Wizard as it is not a Plot. Only check conditions that can be done through the Strategy Wizard are things that can be expressed from a plot. What you need to do is instead of using a BoolSeries, just create and use a plot.
I suggest going through some of these tutorials here to see how plots are created for an indicator: http://www.ninjatrader-support.com/H...tml?Overview23Josh P.NinjaTrader Customer Service
Comment
-
Specifically, I would like to access 3 conditions of an indicator that reference trend, "Uptrend, Downtrend, and Notrend". You say I can only access an indicator's conditions with the strategy wizard using "Plots". I read through the available tutorials and I'm still not clear on how to accomplish this.
So far what I think I need to do is to create a plot called "TrendPlot" and put it with the indicator's Uptrend condition as an action with a value of 1 (TrendPlot=1), Downtrend condition with a value of -1 (TrendPlot=-1), Notrend condition with a value of 0 (TrendPlot=0). Then In the strategy wizard I can choose the "TrendPlot" plot in the conditon builder and say equals 1, -1, or 0 to be an addtional conditions to my strategy conditons.
The exact "how to" is what I need to know. What goes in "Variables", "Initialize()", "OnBarUpdate()", and "Properties"?
ThanksLast edited by kenb2004; 09-28-2010, 05:53 AM.
Comment
-
Hi Ken,
Yes, that's essentially what you'll do: Assign 3 values for plots based on your conditions. What you put in Variables, Initialize, OnBarUpdate, and properties is really up to you. When you create through the indicator wizard, you can define public inputs and plots.
Below is a sample branch that assigns three values based on conditions.
This would go in OnBarUpdate()
Code:if (Close[0] > Open[0]) TrendPlot.Set(1); else if (Open[0] > Close[0]) TrendPlot.Set(-1); else TrendPlot.Set(0);
Ryan M.NinjaTrader Customer Service
Comment
-
Thanks Ryan
Do I need this in Initialize()..?
Plots[0].Min = -1;
Plots[0].Max = 1;
I'm not using the Indicator Wizard, I'm adding this to an existing indicator with the Script Editor and using the Strategy Wizard for my strategy. If I can learn how to add a trend plot to one indicator I'm sure I can do the same with others.Last edited by kenb2004; 09-28-2010, 09:06 AM.
Comment
-
Ken,
No, that statement isn't needed in this case.
If you are adding to existing code, the main thing to setup is the plot.
Initialize() is where the plot is added:
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Properties is where it is declared You need the whole block indicated below for each plot. The values [ ] index increases by one for each plot you need to add. It starts at 0.
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
Ryan M.NinjaTrader Customer Service
Comment
-
OK, so to add my TrendPlot I would do this?
Variables
Nothing
Initialize() is where the plot is added:
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "TrendPlot"));
OnBarUpdate()
if (UpTrendCondition)
TrendPlot.Set(1);
else if (DownTrendCondition)
TrendPlot.Set(-1);
else
TrendPlot.Set(0);
Properties
[Browsable(false)]
[XmlIgnore()]
public DataSeries TrendPlot
{
get { return Values[0]; }
}
Not quite sure how to do the other values...
thanks
Comment
-
Properties
[Browsable(false)]
[XmlIgnore()]
public DataSeries TrendPlot
{
get { return Values[0]; }
}
Is this all I need if my TrendPlot will have 3 different values, 1. -1. and 0? Or do I need to add this?
[Browsable(false)]
[XmlIgnore()]
public DataSeries TrendPlot
{
get { return Values[1]; }
}
[Browsable(false)]
[XmlIgnore()]
public DataSeries TrendPlot
{
get { return Values[-1]; }
}
Comment
-
I add the TrendPlot to Initialize() and compiled no problem.
I added TrendPlot.Set(1); and I got an error: The name 'TrendPlot' does not exist in the current context. So what am I doing wrong?
protectedoverridevoid OnBarUpdate()
other code here
privatevoid colorBar( int bar )
other code here
if(rising)
{
RisingPlot.Set(bar + 1, val2);
RisingPlot.Set(bar, val1);
TrendPlot.Set(1);
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
633 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment