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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        46 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        28 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X