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 HTrader, Yesterday, 09:12 PM
            2 responses
            12 views
            0 likes
            Last Post HTrader
            by HTrader
             
            Started by firstlanetech, Yesterday, 08:56 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by robbersdog, Yesterday, 07:55 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by SuperDude123, Yesterday, 09:08 AM
            2 responses
            42 views
            0 likes
            Last Post SuperDude123  
            Started by trader3000a, Yesterday, 08:01 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X