Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error "Out of range" adding a new data series in chart

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

    Error "Out of range" adding a new data series in chart

    Hello,

    I have an issue in a custom indicator that works fine in a simply chart. It draws lines in principal panel and panel 1.
    Only I get error (Out of range) when I add a new Data Series (in new panel) to the chart.

    I'm using 4 AddDataSeries:

    HTML Code:
    AddDataSeries(_instr_1, TF1Type, TF1Period);
    AddDataSeries(TF2Type, TF2Period);
    AddDataSeries(TF3Type, TF3Period);
    AddDataSeries(TF4Type, TF4Period);

    The new series in chart is in panel 3 so I do not understand where is the conflict.

    I send you screen capture when it works and of the error.

    Could you tell me something about?
    Many thanks



    Attached Files
    Last edited by ClauTrade; 02-22-2022, 01:05 PM.

    #2
    Can you post the entirety of the code for OnStateChange?

    Comment


      #3
      Hello ClauTrade,

      It may be that the AddDataSeries in your script are failing when the chart has to add more data. I see that you are using variables with AddDataSeries which currently is not supported and that is known to fail. As a starting point I would suggest to try and hard code the instruments/settings with AddDataSeries and then re apply and re test. Alternatively after adding the series try removing and re applying your script. When working with variables and AddDataSeries generally you cannot use any of the F5 reload features or switch to different timeframe/symbol features without problems.

      If you still see problems after hard coding the series I would suggest making a small test script that generates the error and then attach that as a reply.

      Comment


        #4
        Hello Jesse,
        many thanks for the suggest but since always I work with variable in AddDataSeries and never had problems.

        I found the bug and it was my mistake: I add a Horizontal Line Draw (Panel 2) in "StateDataLoaded" (it works with one instrument in chart) but fault with more instruments in chart.
        Finally the correct location is in "State.Active" and it works fine.

        HTML Code:
        else if (State == State.Active)
        {
        Draw.HorizontalLine(this, "HLP_cero", 0, Brushes.White, DashStyleHelper.Dot,2, false);
        }
        Many thanks for your support.


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 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
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X