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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        82 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        43 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        68 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        56 views
        0 likes
        Last Post CarlTrading  
        Working...
        X