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.
          Chris L.NinjaTrader Customer Service

          Comment


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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Jeremytang, 07-14-2018, 06:45 PM
            21 responses
            439 views
            0 likes
            Last Post mav8rick  
            Started by LeonK, Yesterday, 09:26 PM
            1 response
            7 views
            0 likes
            Last Post bltdavid  
            Started by NicholasJoannette, Yesterday, 03:01 PM
            2 responses
            11 views
            0 likes
            Last Post NicholasJoannette  
            Started by rach1994, Yesterday, 12:20 PM
            1 response
            35 views
            0 likes
            Last Post bltdavid  
            Started by litamm89, Yesterday, 11:00 AM
            5 responses
            21 views
            1 like
            Last Post rafael_delima86  
            Working...
            X