Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slope()...

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

    Slope()...

    Thanks for the Slope(). Please explain this. My 2 studies are clearly pointing up for currentbar and previous bar. However, as you can see, my readout is showing a negative number. Why? (see attached)

    My code:
    slowLine = Slope(CCI(14), 1, 0);
    fastLine = Slope(CCI(6), 1, 0);

    I tried Slope(CCI(14), CurrentBar-1, 0); But got some really funky output. A very large number. I just want the slope from previous bar to current bar.

    BTW, what is your formula for the calc'ing of Slope();?
    Attached Files
    Last edited by funk101; 05-19-2007, 01:36 PM.

    #2
    Forumula was incorrect. Here is what I am changing it to for the next update. Thanks for pointing this out. I had endBar - startBar, which is correct if the parameters passed in were absolute bar numbers which they are not. They reference the number of bars ago.

    return (series[endBar] - series[startBar]) / (startBar - endBar);
    RayNinjaTrader Customer Service

    Comment


      #3
      Ah!

      Whew! I thought it was me. Glad I could be of service. Thanks, let me know when the update is available.

      Comment


        #4
        Any idea when we'll have the updated slope() method available? I'm unable to edit the indicator because I can't see it.

        Comment


          #5
          Likely end of this coming week.
          RayNinjaTrader Customer Service

          Comment


            #6
            Bump any date on the update?

            Comment


              #7
              I am hoping early this coming week. Just doing some final testing.
              RayNinjaTrader Customer Service

              Comment


                #8
                Great Thanks.

                Comment


                  #9
                  Ray,

                  Is this slope() function using math.atan to calculate slope?

                  Comment


                    #10
                    No it is not.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Slope()

                      If I just want to buy when the 50 EMA slope was greater than 20 degrees, could I use the Slope() to do that? If so, how?

                      Comment


                        #12
                        Yes. Just place the slope function inside an if statement.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Can you give me an example?

                          Comment


                            #14
                            Code:
                            if ((System.Math.Atan(Slope(EMA(50),CurrentBar-1,CurrentBar))*180/Math.PI) > 20)
                                 // Do something
                            Review the discussion here about slope. http://www.ninjatrader-support.com/v...ighlight=slope

                            It has many examples and many different implementation variants that people like to use.

                            Note: A condition of 20 degrees in slope is pretty rare. You usually don't even see 10 degrees of slope.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              You are the best Josh!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              650 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              370 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              574 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              577 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X