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 Mindset, Today, 06:46 AM
      0 responses
      8 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, Yesterday, 05:21 PM
      0 responses
      12 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      15 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      82 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      47 views
      0 likes
      Last Post PaulMohn  
      Working...
      X