Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Number of bars after crossabove

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

    Number of bars after crossabove

    Hi. I have been trying all sorts of different things to get an order to enter after a crossabove but I want it to not enter until after the bar after the crossabove has been completed and meets a condition and if it doesn't meet the condition on that bar then the strategy is reset. So basically I want the order to enter two bars from the crossabove . I have tried creating private int but still can't get it to work. Is there a way to have the crossabove condition trigger the start of the condition and then wait 1 bar to see if the condition still exist before entering an order? Maybe some sort of crossabove=currentbar then somewhere in the condition it says currentbar + 1. Some sort of way to count the bars since crossabove. I hope I am being clear if not let me know.

    Thanks for any help.

    #2
    Hllo,

    There is a lookback period build into CrossAbove(). If you want to ensure that the condition was only true in the last 2 bars, you would use a value of 2.

    if (CrossAbove(RSI(14), 80, 2))

    If thats not what you're looking for, I would suggest reviewing our Reference Sample on Referencing the Correct Bar:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks Matthew for getting back to me. I am going to try out the MRO. I think that will give me what I am looking for. Thanks for the link and the info.

      Comment


        #4
        Hi cre8it8,

        It sounds like you may want to define sequences, where one condition is evaluated after another. There is a good reference sample here that can help with sequences. It uses UserVariables for this, and the entire strategy is built with the strategy wizard. Import it and then edit to see how the sequences are setup.

        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thanks Ryan I will check it out.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          646 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          367 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          570 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X