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 TradeForge, 04-19-2024, 02:09 AM
      2 responses
      28 views
      0 likes
      Last Post TradeForge  
      Started by aprilfool, 12-03-2022, 03:01 PM
      3 responses
      327 views
      0 likes
      Last Post NinjaTrader_Adrian  
      Started by giulyko00, Today, 12:03 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 12:14 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by AnnBarnes, Today, 12:17 PM
      1 response
      2 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Working...
      X