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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            45 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            21 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            31 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Working...
            X