Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sequence contains no elements

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

    Sequence contains no elements

    I get a "Sequence contains no elements" for OBU bar 0.
    The indicator should access a List<double> of a different indicator.
    The list is accessible as other indicators can access its values.

    OBU contains only this:

    nextBuy = WhereToBuy().BuyPrices.Min();
    Print(nextBuy);


    Any idea?

    #2
    That means the list is empty when you're trying to read values from it.

    Comment


      #3
      Oh, so a simple if null check will do the trick?

      Comment


        #4
        Right, you just need to make sure the list isn't empty.

        Comment


          #5
          Can I please get a sample of the null check I should make for a List<double>?

          I tried look up the ContainsValue() method but couldn't find its article.

          Tried here:
          http://www.ninjatrader.com/support/h..._reference.htm

          And here: (link is bad - redirecting to DataSeries Class)
          http://www.ninjatrader.com/support/f...ad.php?t=33061

          Comment


            #6
            Hello savekad,
            What you are trying is more of a C# query and you wont find it in our help guide and beyond what we could support. You can however refer here to this link to know more about it http://www.dotnetperls.com/null-list
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by toughiee, Today, 12:04 AM
            0 responses
            2 views
            0 likes
            Last Post toughiee  
            Started by vdoan20, Yesterday, 08:30 PM
            0 responses
            6 views
            0 likes
            Last Post vdoan20
            by vdoan20
             
            Started by gupagoer, Yesterday, 07:42 PM
            0 responses
            9 views
            0 likes
            Last Post gupagoer  
            Started by Holligoly, Yesterday, 05:13 PM
            2 responses
            11 views
            0 likes
            Last Post Holligoly  
            Started by Raginpower, Yesterday, 01:53 PM
            0 responses
            14 views
            0 likes
            Last Post Raginpower  
            Working...
            X