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

    BarsSinceExitExecution Problem in NT8

    Hi,

    I have a strategy I am trying to migrate to NT8 from NT7 but am running into a problem with one line of the code. There is a BarsSinceExit used in the NT7 code. When I port it over to NT8, I keep getting different results. I have narrowed it down to this one particular line using the BarsSinceExitExecution, but cannot figure out why. I have attached what I believe are identical codes for NT7 and NT8. You will see the results are different between the two. If I remove line 85 in the NT8 code and line 57 in the NT7 code, I get identical results. These lines are identical for each code except the BarsSinceExit or BarsSinceExitExecution for NT7 and NT8 respectively.

    Any ideas on why there is an issue here? I have tried what little I know, but it just seems NT8 is using it differently, or ignoring it. Any help would be appreciated as I would like to migrate to NT8 but can't until I get this resolved.

    Thanks,
    Lee
    Attached Files

    #2
    Hello Lee,

    If you print the value of BarsSinceExitExecution(0,"Long Position",0) and BarsSinceExit(0,"Long Position",0) in both scripts are the printed values different?
    (I would recommend including the time with the print)

    If so, please include the output from each script.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Good question. So I ran them and you are correct, the values are different. The NT7 script seems to be correctly counting the bars. The NT8 script only shows a value of -1? Why would they be different with the same code? I've attached the outputs for each.

      Lee
      Attached Files

      Comment


        #4
        Hi Lee,

        The signal name will need to be the signal name of the exit order.

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

        Comment


          #5
          Hi Chelsea,

          In reviewing the code changes between NT7 and NT8, I see that NT7 used the entry name, but now NT8 uses the exit name (Ahhhhh.....). This may not seem like a big deal, but this totally throws it out of whack because I have two different long exit signals. So it doesn't know which long position exit signal was the last to count from. NT7 just used the entry to count the bars since the last long position exit, which made it easy regardless of which exit was triggered. NT8 is counting from the last exit whether long or short and I think that may be the problem.

          If I use BarsSinceExitExecution(), this gets me close, but then it starts over even for a short trade. I only want this to reset for long exits regardless of which long position exit signal was triggered.

          Is there anyway to get NT8 to act like NT7 here? I know NT8 is supposed to be better, but in this case, I wish it had not changed. Maybe there is a way to record the last long exit signal and save it to be used for the BarsSinceExitExecution until the next long entry where it would reset? This sounds complicated to me considering my experience, but I think that is what NT7 was doing automatically and now NT8 does not. But I'm willing to give it a try as I would like to migrate to NT8.

          Any ideas?

          Regards,
          Lee
          Last edited by lee612801; 07-04-2017, 09:29 PM.

          Comment


            #6
            Hello Lee,

            The BarsSinceExitExecution() when used with the signalName of the exit order will only be counting from orders that have used that signalName.

            Are you wanting to report that this is reporting incorrect values or values for orders that are not using the specified exit order signal name?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              Thanks again for the response. I would love to say its not reporting correctly, but I think NT8 is working as it was intended. But my position is that it actually removes the functionality NT7 had when you could choose the entry signal.

              If the option was provided to use the entry signal like in NT7, this would allow it to work both ways. You could use an exit signal for just a specific exit you wanted, or the entry signal which would then only reset when the specific entry is triggered again regardless of what exit signal triggered the exit. So if there is no way to program this in NT8, then I would definitely prefer this to be added as I haven't found a way to make NT7 match NT8. My opinion is that NT8 should be able to do what NT7 could do.

              Of course I have no idea if this would be considered or implemented. Until then, I will have to continue using NT7. If I could find a work around, that would be great too. I think the bottom line is you have to look how NT7 uses the entry signal, and NT8 uses the exit and how you get the same functionality in NT8.

              Lee

              Comment


                #8
                Hi Lee,

                I understand. You are asking to submit a feature request to revert the behavior back to the implementation in NinjaTrader 7.

                I have submitted a feature request for the NinjaTrader Development to consider this for a future version of NinjaTrader.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Lee,

                  I have received a tracking ID for you request.

                  Your request for BarsSinceExitExecution to match the behavior of BarsSinceExit in NinjaTrader 7 is being tracked with ID #SFT-2503.

                  Please note it is up to the NinjaTrader Development to decide if and when a request will be implemented.

                  We appreciate your suggestion. Please let me know of any other suggestions you have for NinjaTrader.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi,

                    I was interested to see if there has been any change regarding this request? The ID is #SFT-2503. Do you know if this was implemented in NT8?

                    Thank you,
                    Lee

                    Comment


                      #11
                      Hello Lee,

                      At this time request SFT-2503 has not been implemented.

                      As new versions of NinjaTrader are released you can check the release notes for the number from that id.

                      Below is a public link.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi,

                        Any updates on this feature request? I don't see any # this low (2503) in the release notes. Everything starts at 1XXXX, so I don't even know how to track it. I would really like to switch to NT8, but I can't until this get solved as it effects my primary strategy.

                        Is this really that difficult to implement in NT8?

                        Thank you,

                        Lee

                        Comment


                          #13
                          Hello Lee,

                          Items are not going to appear in the release notes in any particular order. These are added as a particular feature request is implemented or a bug fixed, and these are not added by our development in the order they are reported but as development sees fit.

                          SFT-2503 has not been implemented at this time and will not appear in the release notes until it is implemented.

                          However, what is stopping you from coding using the NinjaTrader 8 style in the meantime? You would only need to supply the signal name of the exit order (which actually make much more sense than NinjaTrader 7) instead of the signal name of the entry.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hi Chelsea,

                            I guess the short answer is, it was a limitation of the new coding in NT8... Here was my description of the problem in one of the previous posts.

                            "In reviewing the code changes between NT7 and NT8, I see that NT7 used the entry name, but now NT8 uses the exit name (Ahhhhh.....). This may not seem like a big deal, but this totally throws it out of whack because I have two different long exit signals. So it doesn't know which long position exit signal was the last to count from. NT7 just used the entry to count the bars since the last long position exit, which made it easy regardless of which exit was triggered. NT8 is counting from the last exit whether long or short and I think that may be the problem."

                            If I could get the same results from 8 as 7, I would use 8. But I have not found a way to trick NT8 into only using the entry signal. So if there is a way around this, then please let me know. For now I'm stuck with NT7.

                            I believe I provided the NT7 vs. NT8 code example that highlighted the differences for the BarsSinceExit in one of the previous post. If not, let me know and I can reattach it.

                            Thanks,
                            Lee

                            Comment


                              #15
                              Hello Lee,

                              You can change the logic of your script.

                              Is your script a multi-series script?

                              If not, use the overload that doesn't require a signal name so the BarsSinceExitExecution() applies to all exit orders and ignores the signal name.

                              OR if BarSinceExitExecution("exitName1") is less than BarsSinceExitExecution("exitName2") then "exitName1" was the most recently filled exit order.

                              OR set a bool that switches depending on which exit filled in OnExecution and check the bool before calling BarsSinceExitExecution().

                              (There are likely many other ways you can change your logic to work with the change of BarsSinceExitExecution)
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by manitshah915, Today, 12:59 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post manitshah915  
                              Started by ursavent, Today, 12:54 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post ursavent  
                              Started by Mizzouman1, Today, 07:35 AM
                              3 responses
                              17 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by RubenCazorla, Today, 09:07 AM
                              2 responses
                              13 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by i019945nj, 12-14-2023, 06:41 AM
                              7 responses
                              82 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X