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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
161 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
311 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
245 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
350 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment