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 lightsun47, Today, 03:51 PM
            0 responses
            4 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            8 views
            0 likes
            Last Post 00nevest  
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            44 views
            0 likes
            Last Post futtrader  
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            13 views
            0 likes
            Last Post bltdavid  
            Started by port119, Today, 02:43 PM
            0 responses
            9 views
            0 likes
            Last Post port119
            by port119
             
            Working...
            X