• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

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

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

    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.

    #2
    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.

    Comment


      #3
      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.
      JimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Abilene, Today, 01:27 AM
      0 responses
      4 views
      0 likes
      Last Post Abilene
      by Abilene
       
      Started by simjs, Yesterday, 08:11 PM
      0 responses
      3 views
      0 likes
      Last Post simjs
      by simjs
       
      Started by mrlucky1x, Yesterday, 06:01 PM
      0 responses
      3 views
      0 likes
      Last Post mrlucky1x  
      Started by dedouglas, Yesterday, 03:17 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Jugado, Yesterday, 02:22 PM
      2 responses
      30 views
      0 likes
      Last Post Jugado
      by Jugado
       
      Working...
      X