Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BUG: built-in Slope() method incorrect

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

    #16
    I'm trying to figure out what ticks has to do with slope besides using ticks to calculate slope. Please clarify the clarification!
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #17
      Think of ticks (price) as the y-axis and period (time) as the x-axis.

      Comment


        #18
        Originally posted by mgbloomfield View Post
        Think of ticks (price) as the y-axis and period (time) as the x-axis.
        I know that, and ticks would be used to figure slope on price but I dont understand the request to get the slope in ticks since slope is angle.
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #19
          Originally posted by eDanny View Post
          I know that, and ticks would be used to figure slope on price but I dont understand the request to get the slope in ticks since slope is angle.
          Agreed. I don't want the slope in ticks. Slope is an angle.

          Comment


            #20
            Here is what I use for an indicator slope:

            MyAngle.Set(Math.Atan(Slope(MACD(12,26,9).Avg, 1,0)) * 180/Math.PI);

            which checks angle between current and 1 bar back I haven't tried to apply directly to price.

            Would this work?

            MyAngle.Set(Math.Atan(Slope(Close), 1,0)) * 180/Math.PI);

            Not what I expected.

            This:

            Print("angle " + (Math.Atan(Slope(Close, 3,0) * 180/Math.PI)));

            outputs this:

            angle -1.36434100921404
            angle -1.46645686609606
            angle 0
            angle 1.36434100921404
            angle 1.36434100921404
            angle 1.46645686609606
            angle 1.54752946948938
            angle 1.55175867160589
            angle 1.55334480614343
            angle 1.52893289777454
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #21
              You would need to close the arctangent before multiplying 180/Math.PI. You may want to look around in google to see if this is the proper procedure to convert radians to degrees.
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                My bad when changing to the Print statement. This is better:
                angle -4.76364169072618
                angle -9.46232220802562
                angle 0
                angle 4.76364169072618
                angle 4.76364169072618
                angle 9.46232220802562
                angle 36.869897645844
                angle 42.5104470780008
                angle 45
                angle 22.6198649480404
                eDanny
                NinjaTrader Ecosystem Vendor - Integrity Traders

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ScottWalsh, Today, 04:29 PM
                0 responses
                4 views
                0 likes
                Last Post ScottWalsh  
                Started by rtwave, 04-12-2024, 09:30 AM
                2 responses
                21 views
                0 likes
                Last Post rtwave
                by rtwave
                 
                Started by tsantospinto, 04-12-2024, 07:04 PM
                5 responses
                69 views
                0 likes
                Last Post tsantospinto  
                Started by cre8able, Today, 03:20 PM
                0 responses
                7 views
                0 likes
                Last Post cre8able  
                Started by Fran888, 02-16-2024, 10:48 AM
                3 responses
                49 views
                0 likes
                Last Post Sam2515
                by Sam2515
                 
                Working...
                X