Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

lookback period for indicator comparison - NT7

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

    lookback period for indicator comparison - NT7

    I'm trying to make a comparison of "and ADX was less than DM+ any time within the last 3 bars"
    I can code a simple comparison of this bar < last bar, but how to I use lookback instead of "barsago"? && (ADX(period)[0] < DM(period).DiPlus[1])

    Thanks

    #2
    Hello,

    Thank you for your forum post.

    Please checkout the CrossAbove() and CrossBelow() methods this should do what you need.





    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks,
      I thought of that, but what I really need is "ADX was below both DM+ and DM- within the last 3 bars"
      I was going to use two && lines, one with the DM+ comparison and another for DM-.

      I can use CrossAbove for the DM- comparison, but how can I incorporate CrossAbove when ADX does not cross DM+.

      Is there a way to use "OR" statements, so that I can accomplish:
      &&
      (
      (ADX(period)[0] < DM(period).DiPlus[1])
      or
      (ADX(period)[0] < DM(period).DiPlus[2])
      or
      (ADX(period)[0] < DM(period).DiPlus[3])
      )

      I tried searching Help, but I don't know the correct syntax to search for. "or" is too short.

      Comment


        #4
        Nevermind. Looking at the way the indicator works, all that is necessary is to add the "CrossAbove" to my existing code.
        Other conditions I have programmed already filter out without the need for additional comparisons.

        Thanks for your help.

        Comment


          #5
          Hello,

          Sweet!, glad your up and running.

          Let me know if I can be of further assistance.
          BrettNinjaTrader Product Management

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          571 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          330 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          548 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          549 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X