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

Additional Data Series (higher time frame) in the Strategy Builder

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

    Additional Data Series (higher time frame) in the Strategy Builder

    Are there any rules (limitations) for adding data series in the Strategy Builder? I am trying to use the RSI indicator from the higher time frame, so I added additional data (15 min chart) for Primary Instrument. The strategy says IsFalling(RSI(<Primary>(15 Minute)))=True. Trying to backtest the strategy in the Analyzer with Renko bars and it does not come up with any trades.

    #2
    Hello Radano,

    Thanks for your post.

    Please check the "Log" tab of the NinjaTrader control center when you apply your strategy, Do you see any errors listed?

    What specific version of NinjaTrader8 are you using? (Look under Help>About).

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul, This is what I get: Error on calling 'OnBarUpdate' method on bar 62: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

      How to fix it?

      Comment


        #4
        Hello Radano,

        Thanks for your reply.

        I've been able to replicate the error and this would be unexpected in the Strategy Builder. I have written this up to be reviewed by our QA team. Once they review and agree then it would be escalated to our development team as a bug to correct. Any correction would not be available until the next release of NinjaTrader8

        A temporary fix that I can see at the moment would be to add a condition that accesses a prior bar of the added data series. For example, check if the price of the 15 minute close [1] is greater than Misc>numericValue 0 (an always true condition). This is a harmless condition that will always be true and it forces the strategy builder to generate the correct code to prevent the error.

        I will update this thread when I have further information about the error.

        Last edited by NinjaTrader_PaulH; 06-10-2021, 07:28 AM.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello Radano,

          After review by QA it was noted that this error has previously been reported and is assigned to the development team to resolve for the next release of NinjaTrader.
          The reference is NTEIGHT-14912, " Passing a secondary series in the strategy builder results in bars ago error".

          Once corrected it will be identified in the release notes for the version. All version release notes can be found here: https://ninjatrader.com/support/help...ease_notes.htm

          In the meantime you can use the workaround I advised in post#4 to continue using the strategy in the strategy builder.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_PaulH View Post
            Hello Radano,

            Thanks for your reply.

            I've been able to replicate the error and this would be unexpected in the Strategy Builder. I have written this up to be reviewed by our QA team. Once they review and agree then it would be escalated to our development team as a bug to correct. Any correction would not be available until the next release of NinjaTrader8

            A temporary fix that I can see at the moment would be to add a condition that accesses a prior bar of the added data series. For example, check if the price of the 15 minute close [1] is greater than Misc>numericValue 0 (an always true condition). This is a harmless condition that will always be true and it forces the strategy builder to generate the correct code to prevent the error.

            I will update this thread when I have further information about the error.
            Hello Paul
            the new NinjaTrader version is out and they didn't fix nothing (NTEIGHT-14912)

            I have the same problem like Radano only with an other indicator. To check and implement your temporary fix I made the same Strategy with the RSI only mine is a 900 tick additional data.
            But it isn't working, the question now is, did I do it right?

            Prime chart is a 255 tick and the Strategy is a 900 Tick
            Made a screenshot of the conditions.

            Thank for any help.

            Michael

            Comment


              #7
              Hello michi08,

              Thanks for your post.

              NTEIGHT-14912 has not yet been implemented and remains open in the development team queue.

              Until that is implemented (it will be identified in the release notes found in the help guide, link in post#5), we will have to use a workaround.

              In your screenshot, you are using the close of the default series (in the series 1 field) which is the chart bars. Please change series 1 from "Default input" to the primary 900 tick series.


              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Hi Paul,
                Thank you for response

                I did made the changes, but the strategy works only on a 898 or greater tick chart. On a chart less then 898 tick or time chart it doesn't work.

                Any thoughts?
                Attached Files

                Comment


                  #9
                  Hello michi08,

                  Thanks for your reply.

                  In an earlier post, you advised Prime chart is a 255 tick and the Strategy is a 900 Tick. From this, I assumed the chart was a 255 tick bar and the strategy added a 900 tick bar series. This was what I tested.

                  Can you clarify what you are actually using?

                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_PaulH View Post
                    Hello michi08,

                    Thanks for your reply.

                    In an earlier post, you advised Prime chart is a 255 tick and the Strategy is a 900 Tick. From this, I assumed the chart was a 255 tick bar and the strategy added a 900 tick bar series. This was what I tested.

                    Can you clarify what you are actually using?
                    Sorry about the confusion,

                    The strategy is a rising 900 tick RSI where plots the background of an 255 tick chart.

                    Comment


                      #11
                      Its something like this.
                      Attached Files

                      Comment


                        #12
                        Hello michi08,

                        Thanks for your reply, appreciate the screenshot.

                        We are saying the same thing. The chart is a 255 tick and the strategy has an added data series of 900 tick. I am assuming you are not also adding the 255 tick in your strategy as the strategy will adopt the chart bars so adding them in the strategy is not needed and may be a cause of the differences.

                        I've attached an example that I tested with, it does not place trades. It adds a 900 tick series.

                        Please add the test strategy IsRisingCheck to your 255 tick chart and look for any errors in the "Log" tab of the Ninjatrader control center. If no errors and the strategy name remains green on the "Strategy" tab then that shows there is no issue using the workaround.

                        If you are not adding a 255 tick series with your strategy and you still see the error, there may be some other condition that needs to be looked at.

                        Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

                        Note — To import NinjaScripts you will need the original .zip file.

                        To Import:
                        1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
                        2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
                        3. Select the downloaded .zip file
                        4. NinjaTrader will then confirm if the import has been successful.
                        Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'


                        IsRisingCheck.zip


                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Hello Paul,

                          I did import your strategy and it does work, mine on the other hand doesn't.
                          I don't use the 255 tick data in the strategy.
                          Here are some screenshots
                          Attached Files

                          Comment


                            #14
                            Hello michi08,

                            Thanks for your reply.

                            I would need to see your strategy.

                            You can either attach it here or if you prefer confidentiality, send it into ScriptingSupport[at]NinjaTrader[dot]com. Mark the e-mail Atten Paul, ticket# 313856. Include a link to this thread in the e-mail for reference.

                            You can find your strategy file in Documents>NinjaTrader8>bin>Custom>Strategies> It will be named as you named it with a .cs file type

                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello michi08,

                              To close this off, we worked offline to find a solution for what you were using.

                              A 255 tick chart and the strategy added a 900 tick series.

                              The strategy would error out as previously discussed. What happens is that the strategy builder does not generate the needed code to wait for x bars before trying to run the code created by the various conditions when they use the added data series.

                              In this case, you were using an added 900 tick series in the strategy. The previous recommendation of a workaround still generated the same error. In testing, I found that by accessing the 5th bar ago of the added data series, the needed code is generated by the strategy builder. So we ended up checking the close of the 5th bar of the added data series to see if it was greater than 0 (this is a harmless and always true condition that only needs to be added once).

                              Again this is a workaround until the fix is determined and released in a future version of NinjaTrader8.
                              Paul H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Waxavi, Today, 02:10 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Started by TradeForge, Today, 02:09 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post TradeForge  
                              Started by Waxavi, Today, 02:00 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Started by elirion, Today, 01:36 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post elirion
                              by elirion
                               
                              Started by gentlebenthebear, Today, 01:30 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post gentlebenthebear  
                              Working...
                              X