Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            61 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            9 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            48 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X