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

Series<T> of arrays?

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

    Series<T> of arrays?

    Hello,

    I'm still early on the learning curve for NS and C# ....

    I would like to have my indicator create a an array of 9 doubles for each bar, where the arrays would be stored in a Series<T> so they could be accessed using barsAgo.

    Is this possible, and if so what would the syntax be for creating and instantiating?

    Or would I need to create 9 separate Series<T>'s?

    Thanks very much,
    TNL2

    #2
    Hello tokyonoleo2,

    Thanks for your post.

    You can certainly create individual series.

    Can you clarify what you are trying to accomplish with an array of 9 dataseries?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Basically I want to create smaller time frame bars within the main bar, mainly to characterize the shape of the price movement within the bar without actually adding a 2nd time frame to the chart. I would capture the sub-bars within OnMarketData.

      I hoped to add a singe bar series of arrays, as opposed to multiple bar series' of values, for brevity.

      Comment


        #4
        Hello tokyonoleo2,

        Thanks for your reply.

        Declare: private Series<double[]> myDoubleArraySeries;

        In state.Dataloaded add: myDoubleArraySeries = new Series<double[]>(this, MaximumBarsLookBack.Infinite);

        In OnMarketData you can use: myDoubleArraySeries[0] = new double[9] { populate with your 9 elements of data}

        You can then historical reference data for example myDoubleArraySeries[3][5]; 3 bars ago, 6th element,

        edit - corrected array reference from a data series, was [3,5]
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Fantastic! Thanks so much.

          Comment


            #6
            You asked how to create a series containing arrays.

            This is how you can also create an array of dataseries!
            http://ninjatrader.com/support/forum...91&postcount=3Y

            This was written with NT7 in mind but also works for NT8 if syntax is updated.
            Last edited by Ricam; 07-19-2017, 01:20 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,607 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            16 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X