Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars Ago

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

    Bars Ago

    I am trying to create a strategy that when WilliamsR crosses above -20.5 and then if the following bar closes above the high of the bar that crossed -20.5 : I want to go long on the end of that bar. Using the strategy wizard, I created a strategy. I used "cross above" Williams R -20.5 and I input 1 bars ago. I then used Close (0 bar ago) > High (1 bar ago). However, the strategy is just going long on the first bar that closes above -20.5. It is not looking for my confirmation. I have played with the Bars Ago section on the Williams R and the Close/High pieces for hours now to no avail. Please Help. Thank you.
    Attached Files

    #2
    Please post your code.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      // Condition set 1
      if (CrossAbove(WilliamsR(30), -20.5, 1)
      && ToTime(Time[0]) > ToTime(7, 25, 0)
      && ToTime(Time[0]) < ToTime(14, 0, 0)
      && WilliamsR(30)[0] > -20.5
      && Close[0] > High[1])

      Thank you for your help.

      Comment


        #4
        Your code is working as expected. You are not evaluating the correct bar. Please take a look at your screenshot. The order was actually placed at the end of the big large green bar. Because your conditions were evaluated when that bar was closed your trade actually happens at the open of the next bar. That is what you are seeing and everything is working as expected.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          So what am I missing. WilliamsR crossing above the -20.5 is the first step. But then I want it to confirm the next bar closes above the high of that bar.

          Comment


            #6
            Not sure what you mean. You have one signal bar. From the signal bar you justify if you want to trade or not. If you say yes, then you place a trade. This trade cannot fill until the next available tradeable location. That location is the open of the next bar.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            368 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
            571 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