Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi time series

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

    Multi time series

    Hi, I am trying to add a regime filter to a simple strategy by adding a secondary time series. Idea is that trade will only trigger under certain conditions of same instrument in a higher time frame. It works fine for say minute 1-80, but not for minute over 100 and not for daily. In this case no trades are triggered.

    I am using AddDataSeries(Data.BarsPeriodType.Minute, 80); to import the data and a simple reference in the trading part && (Closes[1][0] > EMA6[0])).

    Enclosed script. Would appreciate if you can see what I am doing wrong here.

    Thanks!!!
    Attached Files

    #2
    Realized this is related to the following error "You are accessing an index with a value that is invalid since it is out-of-range" but no idea how to resolve...

    Comment


      #3
      Hi Jesperboll,

      I ran this and it generated trades for all the scenarios you mentioned, including up to 240 minute bars and daily bars for the added data series.

      It appears the code is not the primary cause of your problem.

      You might have a corrupted or confused database.

      Here are some directions I copied from a reply to one of my posts on how to clear the database cache...something to try.
      • Shut down NinjaTrader.
      • Open the Documents > NinjaTrader 8 > db folder.
      • Delete the sub-folder named 'cache'.
      • Restart NinjaTrader and test.

      Comment


        #4
        Thanks a lot, appreciate your response. I tried clearing the cache but unfortunately makes no difference.

        Comment


          #5
          Hello Jesperboll, thanks for your post.

          The script is not checking that it has enough bars in the secondary series before accessing it. Add:

          if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
          return;

          To your script and the condition will work.

          Kind regards.

          Comment


            #6
            Thanks Chris, that was exactly the issue. Much appreciated!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            79 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            63 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X