Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slope()...

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

    #16
    This is good stuff.....weeds out the flat times!

    How would......

    if ((System.Math.Atan(Slope(EMA(50),CurrentBar-1,CurrentBar))*180/Math.PI) > 20)
    // Do something

    look on a 5 minute chart?

    Comment


      #17
      I'm not sure what it will look like. You'll have to take it from here and play with it yourself.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        Is this code still correct? I've been 'playing' with it and its not very fun...

        Searching in the forums for help, it appears the syntax has changed numerous times which makes it even more confusing.

        If you have time, it might be helpful to make a sample ninjascript that shows how both kinds of slope work in the context of both long and short positions.

        Slope seems like it would be perfect to help avoid rapid whipsaw trades in a sideways markets, but for some reason, what is so obvious visually is so hard to code.


        -EDIT-
        The MASlopeBox indicator has been updated, which is very helpful.
        Last edited by Elliott Wave; 04-13-2008, 02:27 AM.

        Comment


          #19
          The current DOC accurately demonstrates that proper syntax for the Slope() method.
          RayNinjaTrader Customer Service

          Comment


            #20
            Thanks, for the clarification.

            I couldn't find much in the manual on "system.math.atan" type slopes and how they differ, whether or not the value is in degrees, between 1, -1, etc and with the syntax change, looking for answers in the forum raised as many questions as it answered.

            Now that the MASlopeBox works, I'm using that for sample code and by including it in a wizard generated strategy I can see the code in a more usable context, which 'Print(Slope(SMA(20), 10, 0)); ' didn't quite provide.

            Comment


              #21
              If I remember correct the System.Math.Atan provides the answer in radians. You can check the MSDN documents to confirm.
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                I'm pretty sure thats right, from looking at the MASlopeBox code.

                To see if I get this straight:

                ((180/Math.PI) *(Math.Atan(Slope(EMA(Period),1,0)))

                returns a slope value in degrees whereas the NT Slope function returns a value between -1 and 1.

                i.e if the first example returns a 10 degree slope, the NT slope function would return 0.1...

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                633 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                567 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X