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

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.

    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.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          57 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          20 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          9 views
          0 likes
          Last Post cre8able  
          Working...
          X