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 CarlTrading, Yesterday, 11:51 AM
      0 responses
      18 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, Yesterday, 11:48 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-25-2026, 09:53 PM
      0 responses
      27 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 03-25-2026, 09:51 PM
      0 responses
      15 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 03-23-2026, 11:13 AM
      0 responses
      22 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X