public class SampleDoubleSeries : Indicator
{
private Series<double> foo;
private Series<double> bar;
protected override void OnStateChange()
{
if(State == State.SetDefaults)
{
Name = "Sample Double series";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
}
else if(State == State.Configure)
{
foo = new Series<double>(this);
bar = new Series<double>(this);
}
}
protected override void OnBarUpdate()
{
if(CurrentBar < 0) return;
foo[0] = Close[0];
bar[0] = Open[0];
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> Foo
{
get { return foo; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> Bar
{
get { return bar; }
}
#endregion
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Using SMA Indicator on two exposed doubles
Collapse
X
-
Using SMA Indicator on two exposed doubles
I've created a simple Indicator that exposes two double Series called foo and bar. I am trying to add an SMA to a chart and reference one of these however, they do not show up, Here is the Indicator that exposes the doubles:
When I try to reference my SampleDoubleSeries Indicator from the SMA preferences window, I don't see a way to choose either one of my series names foo or bar. Any suggestions would be appreciated.Code:Tags: None
-
Hello swooke,
Thanks for your post.
Exposing a Series object will not make it appear on the property grid. This would be used if you would like to access the Series object as MyInstantiatedSampleDoubleSeries.Foo[0] or MyInstantiatedSampleDoubleSeries.Bar[0] from a hosting script.
If you want to access a Series as the input series for another indicator, a plot must be used.
AddPlot - https://ninjatrader.com/support/help...8/?addplot.htm
Note that you can take the same approach as you are to expose a public Series object, but have the public Series object return the Values[] associated with that plot. The MACD indicator can be used as a reference for how this is done.
Please let us know if you have any additional questions.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
652 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment