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

Not Getting Past Time Series Line

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

    #16
    Hi Chelsea, I tried labeling the values per your video but wasn't sure the results were labeled correctly. Thanks for providing the print line that pulls all the data. The output file from your print line is attached.

    I also changed the TraceOrders to true and included your line

    Print(string.Format("{0} | condition was true"));

    just above the EnterLong() command which I understand to be the action block. I did not see any "condition is true" messages which would be consistent with no orders being placed.
    Attached Files

    Comment


      #17
      Hello,

      If the print within the action block of the condition set is not printing, this verifies the condition is not evaluating as true.

      Is the print for the entire condition? Are there any values that are not being included with the print?

      May I have a reduced script with just that one condition and the two prints to test on my end? (No other logic should be included but this one condition and the prints for it)

      To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
      1. Click Tools -> Export -> NinjaScript...
      2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
      3. Click the 'Export' button
      4. Enter a unique name for the file in the value for 'File name:'
      5. Choose a save location -> click Save
      6. Click OK to clear the export location message
      By default your exported file will be in the following location:
      • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
      Below is a link to the help guide on Exporting NinjaScripts.
      http://ninjatrader.com/support/helpG...-us/export.htm
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Hi Chelsea,

        Attached is the NinjaScript I have been trying to debug with your help. I have only tried to debug the first two lines of Condition group 1. The remaining lines have been commented out. Let me know if you have any questions.

        Thanks,
        Ben
        Attached Files

        Comment


          #19
          Hello Ben,

          Thank you for providing the test script.

          I gave this a test on ES 09-21 1 Min from Aug 2nd to today, but I wasn't able to find anywhere the conditions would have evaluated as true. Either the low was below the open price or the rsi was above 50.

          Are you seeing a specific time and date where the conditions are evaluating as true?

          Attached is the output. (zipped to reduce size for forum)
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Hi Chelsea,

            I ran a backtest for ES 09-21 on 5 minute bars back to 5/4/2021 and got this condition:

            5/4/2021 8:40:00 AM | Low[0]: 4152.5 > OpenPrice: 4151.75 && RSI1.Avg[0]: 46.4465079568738 < 50

            It should have evaluated as true, but I immediately got the following error:

            Strategy 'MyOpenPrice': Error on calling 'OnBarUpdate' method on bar 460: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

            No idea what that means. The output file is attached.
            Attached Files

            Comment


              #21
              Hello Chelsea. Any thoughts on why the error message I mentioned in my post #20 above comes up?

              Comment


                #22
                Hello harr5754,

                Are you seeing that with the sample from post 18? I don't specifically see anything in the sample that would generate that error. If this is something you can reproduce then you could use comments to find the specific line causing the error. You would comment out logic until the error goes away and then uncomment the logic to find the line.

                JesseNinjaTrader Customer Service

                Comment


                  #23
                  Hi Chelsea,

                  I'm getting the error when I run the backtest on ES 5 min bars from 5/01/2021 to 5/31/2021. The error shows up on 5/4/2021 when the following three lines are true:

                  Code:
                   if (
                  // Condition group 1
                  
                  ((Times[0][0].TimeOfDay == new TimeSpan(8, 40, 0))
                  &&  (Low[0] > OpenPrice)
                  && (RSI1.Avg[0] < 50)
                  Here is when it's true from the attached output file:

                  5/4/2021 8:40:00 AM | Times[0][0].TimeOfDay: 08:40:00 == new TimeSpan(08,40,0): 08:40:00 &&
                  5/4/2021 8:40:00 AM | Low[0]: 4152.5 > OpenPrice: 4151.75 && RSI1.Avg[0]: 46.4465079568738 < 50
                  Strategy 'MyOpenPrice': Error on calling 'OnBarUpdate' method on bar 460: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

                  I also attached the Ninjascript "MayOpenPriceWithCommentsLines". I used this Ninjascript to comment out various combinations of the 3 lines above to see which one was causing the problem but was not able to isolate it. Still trying to improve my (nonexistent) debugging skills.

                  Thanks,
                  Ben
                  Attached Files

                  Comment


                    #24
                    Hi Chelsea, please disregard my previous request. I went back and watched your Ninjascript Editor 401 a second time and decided to start over. That's a great video and I learn something new everytime I watch it. Thanks for the hands on debugging instructions.

                    Regards,
                    Ben

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by samish18, 04-17-2024, 08:57 AM
                    16 responses
                    55 views
                    0 likes
                    Last Post samish18  
                    Started by arvidvanstaey, Today, 02:19 PM
                    3 responses
                    9 views
                    0 likes
                    Last Post NinjaTrader_Zachary  
                    Started by jordanq2, Today, 03:10 PM
                    2 responses
                    8 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
                    47 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X