Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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
-
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=4991BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Spiderbird, Today, 12:15 PM
|
2 responses
10 views
0 likes
|
Last Post
by Spiderbird
Today, 12:48 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
0 responses
6 views
0 likes
|
Last Post
by WHICKED
Today, 12:45 PM
|
||
Started by FrazMann, Today, 11:21 AM
|
2 responses
6 views
0 likes
|
Last Post Today, 12:38 PM | ||
Started by rjbtrade1, 11-30-2023, 04:38 PM
|
2 responses
80 views
0 likes
|
Last Post
by DavidHP
Today, 08:12 AM
|
||
Started by lorem, Yesterday, 09:18 AM
|
5 responses
18 views
0 likes
|
Last Post Today, 12:29 PM |
Comment