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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        153 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        305 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        244 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        345 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        176 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X