Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator rising

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

    Indicator rising

    I want to make one of the conditions of a trade that ADX has changed from falling to rising. The trade can ONLY occur during or at the end of the bar on which that change has occurred. If the conditions are not met at the time of the change, then the trade is passed until the next time the ADX changes from falling to rising.

    The sequence must logically be that ADX (0) must be > ADX (1) and ADX (1) must be < ADX (2). (Bars ago in brackets).

    I have played with bools but if it can be specifically stated that ADX must change from falling to rising in that bar, then bool/s are not necessary. I just cannot work out the code I need to do it. If someone can help, I would be most grateful.

    Thanks Karl

    #2
    Originally posted by scartree View Post
    I want to make one of the conditions of a trade that ADX has changed from falling to rising. The trade can ONLY occur during or at the end of the bar on which that change has occurred. If the conditions are not met at the time of the change, then the trade is passed until the next time the ADX changes from falling to rising.

    The sequence must logically be that ADX (0) must be > ADX (1) and ADX (1) must be < ADX (2). (Bars ago in brackets).

    I have played with bools but if it can be specifically stated that ADX must change from falling to rising in that bar, then bool/s are not necessary. I just cannot work out the code I need to do it. If someone can help, I would be most grateful.

    Thanks Karl

    Create a new strategy with the Strategy Wizard, and use it to create the code you want. Copy the code for your indicator. Delete the dummy strategy if you want.

    Comment


      #3
      scartree,

      There are two functions called "CrossAbove()" and "CrossBelow()" and these should work for you.

      For more information, see the links below.



      Adam P.NinjaTrader Customer Service

      Comment


        #4
        Thanks Folk for your suggestions. Adam, the ADX is not crossing anything but is changing from down to up. I am not sure how I could adapt the cross above function to do this.

        I will certainly try the Wiz as K has suggested but for all of its great attributes, Wiz is not adaptable for a task such as this - particularly in the hands of a novice.

        Comment


          #5
          scartree,

          You can use Rising() and Falling()

          Please let me know if I can assist further.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by scartree View Post
            Thanks Folk for your suggestions. Adam, the ADX is not crossing anything but is changing from down to up. I am not sure how I could adapt the cross above function to do this.

            I will certainly try the Wiz as K has suggested but for all of its great attributes, Wiz is not adaptable for a task such as this - particularly in the hands of a novice.
            Actually it is very useful for that purpose. You want ADX falling on bar 1 and ADX rising on bar0. The wizard will generate the exact code that you require.

            Comment


              #7
              Koganam

              It worked a treat - thanks heaps

              Cheers Karl

              Comment


                #8
                Adam, can you kindly tell me how to use rising() and falling() in this instance please?

                Comment


                  #9
                  scartree,

                  if( Rising(ADX(period)) && previously ==false )
                  {
                  previously = true;
                  // do whatever else
                  }
                  else if( Falling(ADX(period) ) )
                  {
                  previously = false;
                  }

                  Looks about as complicated as your original idea : ADX (0) must be > ADX (1) and ADX (1) must be < ADX (2). However, you only have to calculate the ADX data series twice rather than 4 times. If you just store the entire data series as part of your strategy it would make it even more efficient computationally at least.

                  If you want to take into account more of the data series for a rising condition you can use something call "finite difference" or "differential quadrature" rules, or you could just get a moving average of the ADX.

                  Please let me know if I may assist further.
                  Last edited by NinjaTrader_AdamP; 10-31-2011, 07:29 AM.
                  Adam P.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Adam. I will see what I can do with it. Wiz made some nice code that seems to be performing well and heaps simpler for a mug coder like me! The efforts of all of you NT folk is really appreciated.
                    Cheers

                    Comment


                      #11
                      Adam,
                      What NT method or variable should I use for the period of the chart in order to use a finite difference equation or a "derivative in discrete time"?

                      Comment


                        #12
                        Hello carlosavellan,

                        You would want to use BarsPeriod to get the Chart period that you are using.
                        http://www.ninjatrader.com/support/h...barsperiod.htm

                        Let me know if I can be of further assistance.
                        Cal H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        558 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        324 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
                        545 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        547 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X