Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Angle of downward trending SMA.

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

    Angle of downward trending SMA.

    How can I find the ANGLE of a downward trending SMA.

    i.e.

    I look back 30 bars,

    SMA[0] is 1.4855
    SMA[30] is 1.5845

    The Adj of the triangle is (1.5845-1.4855) = 0.099
    and the Opp is 30 bars

    Tan t = Opp/Adj

    This may be a math question:
    How do I get the length value of Opp which is 30 bars
    so that it could be calculated.


    Thank you!



    Attached Files
    Last edited by johnnybegoode; 09-09-2019, 05:47 PM.

    #2
    I drew a triangle so you know what I am actually asking.

    Comment


      #3
      Hello johnnybegoode,

      Generally this is not something you can calculate due to the automatic scaling of the chart, the visuals will change as more or less data is included however the prices do not change. You could instead use the Slope function to find the steepness of the plot and then use math to convert that to degrees or other units. There is a sample in the help guide showing how to use this function along with a sample equation for degrees. https://ninjatrader.com/support/help...lightsub=slope

      I look forward to being of further assistance.

      Comment


        #4
        double Degree0 = Math.Atan(Slope(SMA0,21, 0))*180/Math.PI;
        double Degree1 = Math.Atan(Slope(SMA1,21, 0))*180/Math.PI;
        double Degree2 = Math.Atan(Slope(SMA2,21, 0))*180/Math.PI;

        Why do I get really tiny degree values in the 0.0001 ranges?
        The angles look steeper like 45 degrees and not 0.0001?



        Last edited by johnnybegoode; 09-13-2019, 07:01 PM.

        Comment


          #5
          Hello johnnybegoode,

          I believe this would be caused due to the variable return value of slope based on the prices seen. I located a sample which demonstrates converting prices to an angle rather than using the Slope indicator. You could try this approach instead, the underlying formula is similar to what is noted in the help guide for slope.



          I look forward to being of further assistance.

          Comment


            #6
            I downloaded the indicator and attached it to EURUSD on the chart. It is displaying only between the 179.0000000000000 and 180.000000000000
            range.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            54 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            72 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X