Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Count the number of Add(), plots.

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

    Count the number of Add(), plots.

    How can I count the number of Add()? I'd like to know how many stock "data series" are in existence.
    Also how do you count the number of plots?

    #2
    Hello clocker,
    If you use the below code then can you get the plot counts.

    Code:
    int plotCount = Plots.Length;
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks, but more important how about counting added stock dataseries like Add("NITE", PeriodType.Day, 1);?

      Comment


        #4
        Hello clocker,
        You can check that with the BarsArray property

        Code:
        BarsArray.Length
        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I used BarArray.Length but I got 1 more listed than I've added (I commented out all plots too) which is the extra array is it counting and is it possible to get the type (plot or stock) or the name of array stored?

          Comment


            #6
            Hello clocker,
            Plots, BarsArray are arrays. They are zero based.

            BarsArray[0] -- refers to the primary bar series
            ...

            BarsArray[BarsArray.Length - 1] -- refers to the last secondary series.


            Can you tell me the code snippet you are using.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              I run this in Initialize()
              Code:
              Overlay= false;
              Add("AKSO.OL", PeriodType.Day, 1);
              Add("ALGETA.OL", PeriodType.Day, 1);
              then I run in OnBarUpdate()
              Code:
              print(BarArray.Length);

              Comment


                #8
                Hello clocker,
                You will get 3 as the result.

                The first bar is the primary bar series (on which you have applied the NinjaScript code). The first secondary bar series will be that of AKSO.OL and the second secondary series will be that of ALGETA.OL
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

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