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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      673 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      379 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      577 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      582 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X