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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
68 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
151 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
100 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
288 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment