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, 11: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:
        [FONT=Courier New]if ( CurrentBars[1] < 300) return;[/FONT]
        to

        Code:
        [FONT=Courier New]for(int i = 0; i < 2; i++) if (CurrentBars[i] < 300) return;[/FONT]
        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 PaulMohn, Today, 03:49 AM
        0 responses
        3 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        2 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X