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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            87 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            132 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            65 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            118 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            67 views
            0 likes
            Last Post PaulMohn  
            Working...
            X