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

Accessing an index with a value that is invalid

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

    Accessing an index with a value that is invalid

    Hello,

    I'm having a quite bizarre problem when trying to load an indicator on my charts, it's a 250 period 1 minute Moving Average loaded on a UniRenko chart and sometimes I cannot get it loaded and a log message appears saying that the index is out of range. I allow plenty of bars to load before the indicator starts calculating 1 minute bars, but here is when it gets weird, when I load a chart of 22 days for instance, which has more than enough for the indicator to calculate, it will not load. Then when I decrease the days to 11, the indicator will show up normally. The "OnBarUpdate" starts with if(CurrentBar < 300) return;
    Sometimes it will only load on specific days like 11 days or 5 days but not on 20 or 22 days of data loaded. How bizarre is that?
    it's not a big issue really but its quite annoying to keep trying to find the right amount of days the indicator will feel like loading every time I open the chart.
    Does anyone have a clue on how to fix this?

    Thanks!



    Attached Files
    Last edited by haraldmarc; 09-29-2016, 10:51 AM.

    #2
    Hello haraldmarc, and thank you four your question.

    To help us have a more complete picture of what is occurring, could you provide the following information?

    • Screenshots similar to the ones you have already provided of your Indicator settings
    • A screenshot of your logs tab, containing the exact message you are seeing
    • An excerpt from today's (My) Documents\NinjaTrader 7\trace file which also contains the same message you were seeing
    • If you are not using a built-in indicator, and you have source code for your indicator available, a stripped down copy of this code

    If you would prefer not to share any of this information to the forums, please e-mail it to platformsupport[at]ninjatrader[dot]com and reference this unique ID number : 1580815 . Please also include attn:ninjatrader_jessicap .
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thank you haraldmarc. I just wanted to confirm receiving the files you sent. I am looking into this and will reply shortly.
      Jessica P.NinjaTrader Customer Service

      Comment


        #4
        It looks like you are only checking the second data series for a CurrentBar minimum. I believe if you change the line of code

        Code:
        if ( CurrentBars[1] < 300) return;
        to

        Code:
        for(int i = 0; i < 2; i++) if (CurrentBars[i] < 300) return;
        Then I believe this will resolve your query. Please let us know if there are any other ways we can help.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Christopher Leggit, Today, 01:54 AM
        0 responses
        2 views
        0 likes
        Last Post Christopher Leggit  
        Started by WHICKED, Yesterday, 11:12 PM
        0 responses
        6 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by AdeptistJune, Yesterday, 08:08 PM
        1 response
        6 views
        0 likes
        Last Post bltdavid  
        Started by GKbowen, Yesterday, 04:03 PM
        3 responses
        12 views
        0 likes
        Last Post bltdavid  
        Started by bojim, Yesterday, 08:35 PM
        0 responses
        4 views
        0 likes
        Last Post bojim
        by bojim
         
        Working...
        X