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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
81 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
64 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
66 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
54 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment