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!
See more
See less

Partner 728x90

Collapse

Examples of good ways of working with Series data as array?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_Jim
    replied
    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.

    Leave a comment:


  • RandyT
    replied
    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);
    I'm also doing things like the following, which seems awkward.

    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));
    Is there a cleaner way which I have not figured out?

    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;
            }
    I'm wondering there are any methods available to me that makes it a bit cleaner than the above that I am unaware of.

    If not, this could be considered a request for enhancement to allow these types of manipulations.

Latest Posts

Collapse

Topics Statistics Last Post
Started by ezrollin, Today, 01:29 PM
0 responses
16 views
0 likes
Last Post ezrollin  
Started by vpatanka, Today, 09:25 AM
0 responses
45 views
0 likes
Last Post vpatanka  
Started by Halmix, Today, 07:12 AM
0 responses
34 views
0 likes
Last Post Halmix
by Halmix
 
Started by Bobin, Today, 06:39 AM
0 responses
34 views
0 likes
Last Post Bobin
by Bobin
 
Started by KirkHammett, Today, 03:23 AM
0 responses
17 views
0 likes
Last Post KirkHammett  
Working...
X