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

Bars Since Exit

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

    Bars Since Exit

    I've researched this quite a bit on the forum, and have written this as part of a Strategy Builder group. This strategy seems to work in everything except the 'Bars Since Exit' group. I have a "IF ALL" section with several indicators, and use the group below written under an 'IF ANY' condition. Do I have to put the other items under Conditions in a separate group to make this work or is there something else I'm not understanding here? Also this group follows the other conditions if that makes any difference. Should it be first?

    BarsSinceExitExecution(0, @"LONG EXIT" , 0) = -1
    BarsSinceExitExecution(0, @"LONG EXIT" , 0) >= 10
    BarsSinceExitExecution(0, @"Trail stop" , 0) = -1
    BarsSinceExitExecution(0, @"Trail stop" , 0) >= 10

    #2
    Hello RadarRusty,

    Thanks for your post.

    If I understand correctly you have several other conditions that must be true in addition to any one of the 4 BarsSinceExit() conditions shown for some action to occur and I assume that the action is not occurring.

    As a debugging method, you might try reducing to just two BarsSinceExitExecution() one to check for -1 and the other to check for >= 10 and do not use any signal names. This then would allow the method to respond to any exit. If you then get your action side to work then you can take a closer look at the signal names used.

    If you still do not get the action side to work then you would want to take a closer look at the other conditions to see if one of them is not as expected. The best way to do this is to put each condition in its own set and for the action print an output that shows when each condition is true (alternatively, you could draw a differently colored dot on the chart on each bar where the condition is true (setting the dot at a different Y value do you can see them all) and when all the dots line up you know that the conditions for your multi-condition set would aslo be true.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      So if I understand here, I don't have to have a signal name included?? I thought that was a requirement, and I thought it had to be named exactly as the exit was named. The other conditions work because the programs enters an order when I want, but then enters again too soon after an exit. I will try without names when I get back to my trading computer.

      Thanks!

      Comment


        #4
        Hello RadarRusty,

        Thanks for your reply.

        You would only need the signal name if you wanted to work with a very specific exit. Here is a link to the helpguide section on the method: https://ninjatrader.com/support/help...texecution.htm The example shown does not use any signal names so it would apply then to any exit.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks Paul. I'll change this and give it a try. If I have further trouble, I'll add to this post.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RookieTrader, Today, 09:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by kulwinder73, Today, 10:31 AM
          0 responses
          5 views
          0 likes
          Last Post kulwinder73  
          Started by terofs, Yesterday, 04:18 PM
          1 response
          23 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          7 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Working...
          X