Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding Add Data Series and finding data within the series

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

    Understanding Add Data Series and finding data within the series

    When Adding

    AddDataSeries(Data.BarsPeriodType.Minute, 1); Is that BarsInProgress == 1;

    Lets Say I have a total of 14 Add DataSeries
    Would this work



    if (IsFirstTickOfBar == true)
    {
    if (BarsInProgress == 0 && CurrentBars[0] >= 20 && CurrentBars[14] >= 20 && CurrentBars[15] >= 20)
    {
    MySeries[0] = Closes[14][0] - Closes[15][0];
    }
    }

    I keep on getting Index was outside the bounds of the array.

    #2
    Hello ballboy11,

    As long as you are checking that the data exists before doing that it should be fine. Are you certain it is this line causing the error or are you using the MySeries or any other indexes anywhere else? If you have a more complete sample of your OnBarUpdate that may help to see what is happening, I don't see what would be the problem from this snippet. You may also want to simplify the problem and test with 3 series and see if you get the same issue.

    If you added 14 extra series we should see 14 as the last index because 0 will be the primary. Should this instead be Closes[13] and Closes[14] ? Using CurrentBars/Closes[15] would cause an index error if it doesn't exist.

    I look forward to being of further assistance.

    Comment


      #3
      Is there a way in the output box to print out the AddDataSeriesName and the type. I would like to loop through to see how many DataSeries in the system it detects

      Comment


        #4
        Hello ballboy11,

        You can know how many it with "detect" by how many AddDataSeries you used. You start with a count of 1 for the primary which is index 0 and then count up from there. If you had used 4 AddDataSeries statements you would have indexes: 0,1,2,3,4. If you used 14 AddDataseries statements you would instead have 14 indexes past 0 or 15 total series.

        If you want to print them in a different way you could use the BarsArray[BarsInProgress].Instrument to gather properties from that specific series.

        You likely need to use different indexes in the code you provided but I would need to see your AddDataSeries statements to know what indexes should be used there. If you have 14 total AddDataSeries statements you need to decrease the index you used by 1 for each, 15 wont be valid.


        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

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