Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

      JesseNinjaTrader Customer Service

      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 dcriador, Today, 12:06 PM
        0 responses
        6 views
        0 likes
        Last Post dcriador  
        Started by dcriador, Today, 12:04 PM
        0 responses
        5 views
        0 likes
        Last Post dcriador  
        Started by cutzpr, Today, 08:54 AM
        0 responses
        11 views
        0 likes
        Last Post cutzpr
        by cutzpr
         
        Started by benmarkal, Today, 08:44 AM
        0 responses
        17 views
        0 likes
        Last Post benmarkal  
        Started by Tin34, Today, 03:30 AM
        2 responses
        28 views
        0 likes
        Last Post Tin34
        by Tin34
         
        Working...
        X