Announcement

Collapse
No announcement yet.

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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        30 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        286 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        282 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        132 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X