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 Mindset, 04-21-2026, 06:46 AM
|
0 responses
44 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
56 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
35 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
95 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
57 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment