• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Series<bool> causing error "index was outside the bounds of the array"

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

    Series<bool> causing error "index was outside the bounds of the array"

    I am having a strange issue with one of my Series<bool> objects where it causes the script to fail and displays the above error message. What's strange about it is that I have another script that I literally copy and pasted the code from that runs into no issues while calculating over the same data. The script also fails well into the data, i.e. on bar 4378.

    Code:
    private Series<bool> upTrend;
    then in state.config...

    Code:
    upTrend = new Series<bool>(this);
    onbarupdate...

    Code:
    upTrend[0] = (paradigms[0] == up4 || paradigms[0] == up2 && paradigms[1] == up4)  ?  true : false;
    Even in the same problematic script, I have two other series<bool> objects called noTrend and dnTrend that calculate with no issues whatsoever. They are not really different, they are just defined by a different order of the array paradigms[], and besides, the script runs if I comment out ONLY the line I wrote here above in onbarupdate.

    Any ideas? thanks

    #2
    Hello lunardiplomacy,

    Thank you for your post.

    What I'd suspect here is that somehow one of those series doesn't have something assigned on the bar you're looking at, causing the null reference error. I'd recommend adding prints to print the value of the paradigms[0] and paradigms[1] on each bar to see if one of those prints something strange when it throws the error.

    This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

    https://ninjatrader.com/support/foru...ns-not-working

    If you run into issues like we saw here, the above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the two.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rubnnderinslo, Today, 09:43 PM
    0 responses
    3 views
    0 likes
    Last Post rubnnderinslo  
    Started by kirkvan, Today, 09:03 PM
    0 responses
    6 views
    0 likes
    Last Post kirkvan
    by kirkvan
     
    Started by hedgeplay, Today, 08:35 PM
    0 responses
    5 views
    0 likes
    Last Post hedgeplay  
    Started by jaboo, Today, 06:38 PM
    0 responses
    12 views
    0 likes
    Last Post jaboo
    by jaboo
     
    Started by 7robert, Today, 06:05 PM
    0 responses
    15 views
    0 likes
    Last Post 7robert
    by 7robert
     
    Working...
    X