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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        51 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        30 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        99 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        177 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        170 views
        0 likes
        Last Post CarlTrading  
        Working...
        X