Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Slopes

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

    Slopes

    Hello

    I'm looking for a straightforward way to get the slope of a Moving Average.
    I've looked at the "slope" command but I find the results to be unsatisfactory, mainly because of the varying granularity, ie a slope of 25 degrees for the Euro FX (6E) will be a number like 0.04367 whereas the same 25 degree slope for the Dax will be 3.7 for example.

    Is there an easy way to get a moving average's slope in degrees that's applicable to every market (0 being flat and 90 being vertical)?

    Thanks

    #2
    laocoon,

    Please remember that slope is very subjective as to the scaling of your chart and how you are viewing it. If you scrunch the chart a lot it may seem like the slope is a lot steeper. If you space things out the slope will seem less steep.

    Slope() returns you numbers in radians. You will need to convert it to degrees should you want the degree equivalent of it. The slope method is a basic rise/run calculation with the run being 1 for each bar, just like back in the algebra days.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply Josh. Would you have a NinjaScript example of how to convert radians to degrees?

      What I need to do basically is to define on a candle by candle basis if the 3SMA is rising or falling. This is obviously an easy thing to do visually, but the values I get with the slope function don't match. If for example the 3 SMA is rising for 3 candles in a row and then falling for two candles in a row, I will still get a positive value although on screen the SMA is clearly falling and therefore negative.

      Thanks

      Comment


        #4
        Here is an old thread with some discussion on the mathematics that need to occur: http://www.ninjatrader-support2.com/...ighlight=slope
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Today, 11:02 AM
        1 response
        1 view
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by geotrades1, Today, 10:02 AM
        4 responses
        11 views
        0 likes
        Last Post geotrades1  
        Started by rajendrasubedi2023, Today, 09:50 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by lorem, Today, 09:18 AM
        2 responses
        11 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        4 responses
        30 views
        0 likes
        Last Post geddyisodin  
        Working...
        X