Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

get the series added by NinjaScript by name

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

    get the series added by NinjaScript by name

    Is there any way to get the series added by NinjaScript by name as opposed than by index?
    I mean I could capture the index when I AddSeries; however I feel it would be safer to be able to retrieve them using the name. Is there such a way?
    thanks

    #2
    is it possible?

    Comment


      #3
      Hello robbymane,

      There is not a specific property for that, you could use a variable though.

      int firstSeries = 0;
      int secondSeries = 1;

      Closes[firstSeries][0]

      Comment


        #4
        thanks but I think that does not ensure that the first index or any index won’t get filled with a different series…
        curious why there is not a property for it..

        Comment


          #5
          Hello robbymane,

          I am not certain I know what you mean, are you asking how to submit an order to a specific series?

          The reason that indexes are used is because the collection being used is an array, that is the only way to select an item in the array by its index. The order which you use AddDataSeries determines the order of the indexes, 0 is always the primary series and then each additional index after that is based on the order of your AddDataSeries statements.

          Comment


            #6
            Yes i understand I just thought there was another way to retrieve Series; because what if the array gets corrupted or one bar object is deleted I wondered what would happen to the other objects wouldn’t the indices get messed around.. What if you were to AddSeries and then let’s say you have 2 series on the chart and you delete one of the series what would happen to the other indices. Thays why i was looking for a more efficient way to retrieve the Series.

            Comment


              #7
              Hello robbymane,

              There is nothing that would corrupt the arrays, they are in a specific order that is controlled by the platform.

              The script will only use the primary series from the chart, adding or removing other series won't affect your script which is running on the primary. AddDataSeries adds data to the script directly and not to the chart.

              Comment


                #8
                Ahh thanks; I think I should make myself clearer;
                Actually I am adding custom type series from different timeframes in my script and i
                need to run some functions on them and get a result ; so basically i’m not trading those series I just need information from them. I understand you have resources about multitimeframe indicators; but still it does not explain the way to track a series; index is just not sufficient. Let say I are an indicator to a chart with 2 existing charted series then i add my script which creates 3 more series then I add a series on the chart. then i decide to remove some series or the chart series; it seems pretty tricky to tracking per index.. what happens to the indices then do they shift or do we just place a nine value in the empty slots?

                Comment


                  #9
                  Hello robbymane,

                  If you add an indicator to a chart with 2 series that indicator is only using 1 of the charts series, the other is completely ignored. You can ignore any other series in regard to the scripts indexes as those do not count. If you remove the series which the indicator is applied to that will also remove the indicator. Changing the order of the series in the chart also does not matter to the indicator because it knows which primary series it was applied to.

                  The indexes in your code are going to always be in the order of 0 being the primary and then +1 each time you use AddDataSeries. For example if you add 2 additional timeframes to the script you will have indexes 0 1 and 2 which can be used to pick the series using the syntax Closes[indexOfSeries][barsAgo]

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  599 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  345 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  558 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  558 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X