Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Absolute current close
Collapse
X
-
savekad,
You can use something like this :
SMA(41)[0] to access elements of an indicator for example. There is no need to use the Add() method. If you are wanting to instantiate an indicator you can do this as well.
IndicatorBase SMA = new SMA(period);
Here is a sample that works with instantiated indicators : http://www.ninjatrader.com/support/f...d=4&linkid=535Adam P.NinjaTrader Customer Service
Comment
-
Oh no, I don't want to access elements of some other indicator. In the indicator I am building, I created a DS object which to it I save some close values from bars on the chart. Later in the code, I want to access the values I saved in the aforementioned DS object. How do I do that?
Comment
-
It isn't finished but it goes something like this:
Let's say that I want to draw a ray from all close values that are above the price 1300.00.
I create a DataSeries object and code OnBarUpdate() to:
if (Close[0] > 1300.00)
{
dso.Set(Close[0])
}
I am left with a DS object that holds values above 1300.00 and their corresponding CurrentBar int, correct?
How do I later, draw a ray for those prices, a ray that will start from the relevant bar?
This example is quite of a nonsense, I know, but it is simple and will do the trick.
Comment
-
A DataSeries is an object with properties .It has nothing to do with how it was created. The DataSeries elements are indexed backwards, 0 being the most recent, and increasing monotonically into the past until the number of entries in the DataSeries equals the number of bars on the chart.Originally posted by savekad View PostBut if I didn't use the Add() method to create a DS object, then how do I address its elements?
You may be overthinking this.
If you want to access a member of a DataSeries, just use its index to do so.
Comment
-
So every DSo has access properties? What are they than? And if I have several DS objects that were not created via the Add() method, how do I access their properties? Simply using the full name DataSeriesObject.PropertyName[barsAgo] and it will return the double stored there?
Let me know if I got it right.
Comment
-
savekad, if you run into the need to expose internal dataseries of other indicators, please keep this reference in mind - http://www.ninjatrader.com/support/f...ead.php?t=4991
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
576 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment