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
Examples of good ways of working with Series data as array?
Collapse
X
-
Hello RandyT,
Thanks for your post.
Series<T> objects can be synchronized entirely to the data series with MaximumBarsLookBack.Infinite or with only the last 256 values with MaximumBarsLookBack.TwoHundredFiftySix. There currently are not any other MaximumBarsLookBack options.
My recommendation would be to take the same approach you currently are; to make a function that will convert the series to an array of your desired length and then use the array as you normally would.
I've submitted two feature requests on your behalf for consideration in a new version of NinjaTrader:
Ability to customize MaximumBarsLookBack values - SFT-3432
Additional methods for Series<T> to be used like Arrays - SFT-3433
Feature request interest is collected before it is decided if the feature should be implemented, so we can't offer an ETA. Once implemented, the ticket ID can be found publicly on the Release Notes page of the help guide.
Release Notes: https://ninjatrader.com/support/help...ease_notes.htm
If there is anything else we can do to help, please let us know.
-
To expand on this a bit more...
I need to maintain an Array with the last 10 values.
Can I create the Series with MaximumBarsLookBack value of 10?
Code:myQueue = new Series<double>(this, 10);
Code:stdDevQ = new Series<double>(this, MaximumBarsLookBack.TwoHundredFiftySix); stdDevVal = StdDev(stdDevQ, Length); stdDevVal[0] = (Close[0] / Close[1]); // copy last 10 values from Series and Sum(). val1 = Math.Sum(FunctionToCopySeriesVals(stdDevVal, 10));
I appreciate any guidance on this.
Leave a comment:
-
Examples of good ways of working with Series data as array?
I was wondering if someone could offer some good examples of how to work with values in a Series more as if it were an Array.
I've taken to doing things like the following to snip a length of values from a Series type to then do things like Sum(), Sort(), ranking, etc.
Code:static public double[] ArrayQueueToArray(Series<double> aq, int length) { double[] toArray = new double[length]; for (int i = 0; i < length; i++) { toArray[i] = aq[i]; } return toArray; }
If not, this could be considered a request for enhancement to allow these types of manipulations.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DavidHP, Today, 07:56 AM
|
1 response
5 views
0 likes
|
Last Post Today, 08:16 AM | ||
Started by kujista, Today, 06:23 AM
|
3 responses
6 views
0 likes
|
Last Post
by kujista
Today, 08:15 AM
|
||
Started by Mindset, Yesterday, 02:04 AM
|
2 responses
17 views
0 likes
|
Last Post Today, 08:15 AM | ||
Started by f.saeidi, Today, 08:03 AM
|
1 response
5 views
0 likes
|
Last Post Today, 08:15 AM | ||
Started by samish18, 04-17-2024, 08:57 AM
|
15 responses
52 views
0 likes
|
Last Post Today, 08:13 AM |
Leave a comment: