Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator on simulated data does not work

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

    indicator on simulated data does not work

    Hello

    I am trying to test my custom build indicator on a simulated data feed and it does not work, I narrowed down my problem to a simple problem: "double s = SMA(20)[0];" gives an error "Error on calling the 'OnBarUpdate' method for indicator 'EMArate2cross' on bar 0: Index was out of range. Must be non-negative and less than the size of the collection.", and I have more than 20 bars on my screen.

    I see data on my chart and simple SMA(20) plots fine but why I can not use output of SMA(20)[0] in my program. Is it something related to a simulated data feed?

    In general I want to do something like this

    for (int i=0; i<10; i++) sum = sum + SMA(20)[i];

    Sergey.

    #2
    follow up

    During debugging I get "SMA(20).Count" => 3276, but I still can not assess SMA(20)[i], where i is any number including 0, 1, 3000, and so on. It seems to me that indexing is corrupted.Have a feeling that it may be only for a synthetic data feed.

    Comment


      #3
      I believe your problem lies in the associated "Tip" located at the link below.

      RayNinjaTrader Customer Service

      Comment


        #4
        Thank you.

        This fixed my problem.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        594 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        554 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X