Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SMA throws exception

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

    SMA throws exception

    Hi,

    same SMA i've used in NT7 is throwing an exception now when calling
    SMA(Closes[index], barCount)[0]

    Closes[index].Count = 968 & barCount=20 , so no problem should be happening..
    The exception thrown is:
    "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}

    Again, the exact line of code with the same parameters is always working in NT7.

    #2
    Hello liorsham,

    Thank you for your post.

    Are you checking there are enough bars to load with CurrentBars?
    For example:
    Code:
    if(CurrentBars[0] <= barCount || CurrentBars[1] <= barCount)
    return;

    Comment


      #3
      Thanks. it seems that helped.
      interesting though I didn't have to do it in NT7.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Waxavi, 04-19-2024, 02:10 AM
      3 responses
      41 views
      0 likes
      Last Post gaz0001
      by gaz0001
       
      Started by Max238, Today, 01:28 AM
      2 responses
      26 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by Shansen, 08-30-2019, 10:18 PM
      25 responses
      949 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      8 responses
      42 views
      0 likes
      Last Post JonesJoker  
      Started by timko, Today, 06:45 AM
      0 responses
      7 views
      0 likes
      Last Post timko
      by timko
       
      Working...
      X