Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 bortz, 11-06-2023, 08:04 AM
        47 responses
        1,605 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        8 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        4 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        13 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X