Announcement

Collapse
No announcement yet.

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.

    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.

        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 NullPointStrategies, Today, 05:17 AM
          0 responses
          50 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          69 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X