Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

LinRegSlope indicator isn't the slope of LinReg?

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

    LinRegSlope indicator isn't the slope of LinReg?

    I am trying to use the slope of a linear regression (LinReg) in a strategy, I figured that LinRegSlope fit the bill. However when I compared the two indicators on a chart, I found a lack of correspondence.

    In the attached file, the LinReg is plotted next to the security price line, in yellow. LinRegSlope is down below. I've drawn a circle around a point where the LinReg appears to have zero slope, however LinRegSlope takes on a value of ~.25 at that point. Similarly, the LinReg curve slopes down towards the red arrow, However LinRegSlope stays positive the entire time.

    Am I misusing this indicator? Or what's going on here?
    Attached Files

    #2
    Hello Konoakapen,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    The LinRegSlope uses the value of the Slope within the LinReg before it adding the intercept value and multiplying by the period of the LinReg. So this is taking the Linear Regression Slope, if you wanted to the slope of the Linear Regression's plot you would need to create a custom indicator that plots the Slope(LinReg(Period), Period-1, 0).

    For information on Slope in NinjaScript please visit the following link: http://www.ninjatrader.com/support/h.../nt7/slope.htm

    For information on the Linear Regression Slope please visit the following link: http://www.ninjatrader.com/support/h...sion_slope.htm
    You can also view the code by going to Tools > Edit NinjaScript > Indicator > LinRegSlope.

    Comment


      #3
      Thanks for the help. However, I think the correct syntax with Slope would be Slope(LinReg(period), 1, 0) to calculate the current slope, rather than calculating the slope over the past period-1 days.

      Comment


        #4
        Slope of regression line

        I think that you completely misunderstood the concept of the regression slope. The slope is not the slope of the curve but the slope of the regression line.

        LinReg: The LinReg indicator plots the end point of the regression line of a linear regression channel. For each bar imagine a regression channel calculated from the last 50 bars. Then take the end points from all of those regression channels and you obtain the plot of the LinReg indicator.

        LinRegSlope: This is not the slope of the indicator that plots all the regression endpoints. LinRegSlope calculates the slope of the regression line for each bar. The chart shows a situation where the regression line of the regression channel is horizontal. This corresponds with a zero slope for the regression line and is correctly indicated by the indicator.
        Attached Files
        Last edited by Harry; 05-10-2014, 04:22 AM.

        Comment


          #5
          Slope of LinReg end point curve

          Just apply a 1-period momentum to the LinReg indicator, and the slope of the end curve point will be shown.
          Attached Files

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gentlebenthebear, Today, 01:30 AM
          2 responses
          13 views
          0 likes
          Last Post gentlebenthebear  
          Started by Kaledus, Today, 01:29 PM
          2 responses
          7 views
          0 likes
          Last Post Kaledus
          by Kaledus
           
          Started by frankthearm, Yesterday, 09:08 AM
          13 responses
          45 views
          0 likes
          Last Post frankthearm  
          Started by PaulMohn, Today, 12:36 PM
          2 responses
          16 views
          0 likes
          Last Post PaulMohn  
          Started by Conceptzx, 10-11-2022, 06:38 AM
          2 responses
          56 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Working...
          X