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

BarsSinceExitExecution Problem in NT8

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

    #16
    Chelsea,

    Thanks for the suggestions, I will give them a try. What specifically is the overload for BarsSinceExitExecution() ?

    Thanks,
    Lee

    Comment


      #17
      Hello Lee,

      (edit corrected link)
      Below is a public link to the help guide for BarSinceExitExecution().


      The overload would be the one without parameters.
      Last edited by NinjaTrader_ChelseaB; 09-09-2018, 01:30 PM.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        HI Chelsea,

        So I gave a couple of your suggestions a try including the overload option, and still could not get the NT8 code to work as the NT7 for the BarsSinceExit. I have attached an example code for NT7 and NT8. If you wish, I can send you the full codes I have for both.

        I'm not sure how to proceed since I have not seen my enhancement request addressed to make the NT8 like NT7 for BarsSinceExit and I have not been successful yet in getting them to work the same with other means.

        Any other suggestions/recommendations are apprecieated.

        Regards,
        Lee
        Attached Files

        Comment


          #19
          Hello Lee,

          With the scripts you have provided the exit order name is 'Exit Long Position'.

          The call to BarsSinceExitExecution() should be:

          BarsSinceExitExecution(0,"Exit Long Position",0)
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Hi Chelsea,

            So I tried your suggestion, but still did not get the same results between the two, which I would expect. The other problem is if you have more than one entry, this approach would not work if you just want whichever one exits first.

            But let's take it one step at a time. Did you get identical results when you ran both these scripts with the correction you provided?.

            Regards,
            Lee
            Last edited by lee612801; 09-11-2018, 06:49 PM.

            Comment


              #21
              Hello Lee,

              Yes, after making that change I am getting the same results in NinjaTrader 8 as NinjaTrader 7.

              Attached is a screenshot.


              If your are getting different results, I would recommend using prints to understand the behavior and find what is different.

              Below is a public link to a forum post that demonstrates using prints to understand behavior.
              Attached Files
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Chelsea,

                I looked at the orders with a shorter time period to see where the entry and exits signals are. I still am not getting the same results. The only thing that I can see is the BarsSinceEntry and BarsSinceExit not working the same between the two which I've have seen from the beginning.

                Here are the NT7 and NT8 scripts I used and a couple images from the results.

                Regards,
                Lee
                Attached Files

                Comment


                  #23
                  Hello Lee,

                  Add prints that print the values of all variables used in the conditions along with the time of the bar.

                  If you include the output with your next post I will be happy to assist you in analyzing the output from the prints.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    Hi Chelsea,

                    Ok, per looking at things one step at a time, I have added the print command to the scripts and checked them again. What I found was they are still showing different results due to the BarsSinceExitExecution, but also it seems to be due to NT8 not recognizing the Bars Required To Trade and the Exit On Session Close.

                    I changed the BarsSinceExitExecution to be the Entry Signal, and if I set the Bars Required To Trade = 0 for both NT7 and 8 and uncheck the Exit On Session Close, I seem to be getting the same result. I'm not sure this addresses the original issue yet because these test scripts only have a single entry as opposed to the multiple entries my actual strategy has. But this is a good start.

                    I thought the issues with the Bars Required To Trade and Session Close could be due to the version I have. So I uninstalled NT8, downloaded and installed the latest version and checked again. Same problem.

                    Can you help verify the issues I'm having with NT8 regarding the Bars Required To Trade and the Exit On Session Close? I am setting these parameters in the Strategy window, but it seems NT8 is just not recognizing the settings.

                    Thank you,
                    Lee
                    Attached Files
                    Last edited by lee612801; 10-04-2018, 02:51 PM.

                    Comment


                      #25
                      Hello Lee,

                      You are using BarsSinceExitExecution incorrectly. This needs the signal name of the exit order not the entry order.

                      This is detailed in post #4.

                      The code:
                      Code:
                      if (Position.MarketPosition == MarketPosition.Flat && (BarsSinceExitExecution(0,"Long Position",0) == -1 || BarsSinceExitExecution(0,"Long Position",0) > IdleBars))
                      Should be:
                      Code:
                      if (Position.MarketPosition == MarketPosition.Flat && (BarsSinceExitExecution(0,"Exit Long Position",0) == -1 || BarsSinceExitExecution(0,"Exit Long Position",0) > IdleBars))
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #26
                        Hi Chelsea,

                        Ok, I changed the NT8 script back to include "Exit Long Position", and I'm still getting different results from the BarsSinceExitExecution. Also, the Exit On Session Close is not working in NT8.

                        I'm using a Day time period from 01/01/17 - 10/10/18

                        Here are the scripts. Why are these providing different results?


                        Lee
                        Attached Files

                        Comment


                          #27
                          Hello lee612801,

                          In the NT7_FS script BarsSinceExit() is being used incorrectly.

                          Below is a public link to the help guide.


                          Please see Parameters > signalName.

                          NinjaTrader 7's BarsSinceExitExecution and NinjaTrader 8's BarsSinceExit are called differently.

                          Please see Post # 5 where this was acknowledged.

                          Use prints to understand what is different so that you can focus on that specific code. Print all values for all variables for all conditions that place orders along with the time of the bar.

                          Below is a public link to a forum post that has videos that demonstrate how to use prints to understand behavior.


                          Please include the output from the prints and I will be happy to assist you in analyzing the output.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #28
                            Did you ever get this to work, I certainly cannot

                            Comment


                              #29
                              Hello DTSSTS,

                              Attached is an example.
                              Attached Files
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by CortexZenUSA, Today, 12:53 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post CortexZenUSA  
                              Started by CortexZenUSA, Today, 12:46 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post CortexZenUSA  
                              Started by usazencortex, Today, 12:43 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post usazencortex  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              168 responses
                              2,265 views
                              0 likes
                              Last Post sidlercom80  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              3 responses
                              11 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X