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

Linear regression Slope

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

    Linear regression Slope

    I am interested in the linear regression slope indicator. I found a script written by a couple of guys from NinjaTrader at this web site:

    It looks nice there in the pictures but ti does not seem to work with 6.5. It fires an error saying that the startBarsAgo cannot be lower than the endBarsAgo.
    In any case, if someone has that script running for 6.5 and wants to post it; it would be nice.
    Thanks!

    #2
    Try swapping the value for the startbarsago and the endbarsago.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      No, that did not do it. This is the line causing the problem.
      LRSlope.Set(Slope(LinReg(Period), CurrentBar - Period + 4, CurrentBar));

      Thanks

      Comment


        #4
        When you use the barsAgo context you can't go to the beginning of the chart with CurrentBar in the manner you have.

        CurrentBar in barsAgo effectively brings you to the beginning of the chart. If you end at the beginning of the chart it just doesn't make sense. Run through the logic again and replace the numbers with where you want it to start and where you want it to end.

        If you start 5 bars ago you need to end maybe 1 bar ago or 0 bars ago. Then you also need to make sure that you don't start pass the total amount of bars in the chart. So your startBarsAgo cannot start pass CurrentBar.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi, yes, this line did not make sense to me either. I did not write it, someone in your company did and it came from the file distribution that you have somewhere in this web site. I downloaded it yesterday. In a way I was making you guys aware of the bug. My bad for not being explicit, my apologies. In any case, that is why I asked if someone had already fixed it or had an script that actually did the calculation I was interested in (the linear regression slope).
          Thanks!

          Comment


            #6
            The Linear Regression Slope indicator is not a default indicator. It is probably from a indicator pack you downloaded and installed. What happened earlier is that the usage of the Slope() function was different in NT6.0 so now in NT6.5 it changed a bit so the parameters need tweaking to work properly.

            Do you remember which indicator pack you got the LinRegSlope() from?
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I got it from a file called December2007SC.zip. Don't know if that tells you something. It was part of an article from Stocks and Commodities magazine, issue December 2007. I found it as well here in this web site, but don't recall where.
              Thanks!

              Comment


                #8
                Great. Thanks for the information. I will look into getting the indicator updated.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by Josh View Post
                  Great. Thanks for the information. I will look into getting the indicator updated.
                  Josh,

                  Any luck on getting this Linear Regression Slope indicator to work? I could REALLY use it. Thanks

                  Comment


                    #10
                    It should already be updated in the file sharing section. Let me know if it does not seems otherwise.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      I just looked at it, and the current version of the indicator in the file sharing section has the line of code in question changed to:

                      Code:
                      LRSlope.Set(Slope(LinReg(Period), Period + 4, 0));

                      Comment


                        #12
                        Sill does not work

                        I followed this thread and was told

                        had been updated, but when I try and run it it crashes
                        Attached Files

                        Comment


                          #13
                          Hello cme4pif,

                          That is because this Indicator was exported using NinjaTrader 6.5.0.9.
                          http://www.ninjatrader.com/support/forum/local_links.php?catid=1&linkid=4

                          If open up the ".zip" file you will see the two files "LinRegSlope" and "Rsquared" that are apart of the file. In NinjaTrader 7 these indicators come preloaded when you install NinjaTrader that is why you are getting a duplicate name method.

                          Open up a chart and right click inside the chart then select Indicators. If you scroll down you will see both indicators that you can apply to the chart.

                          Let us know if we can be of further assistance.
                          JCNinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by cls71, Today, 04:45 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post cls71
                          by cls71
                           
                          Started by mjairg, 07-20-2023, 11:57 PM
                          3 responses
                          213 views
                          1 like
                          Last Post PaulMohn  
                          Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                          4 responses
                          544 views
                          0 likes
                          Last Post PaulMohn  
                          Started by GLFX005, Today, 03:23 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post GLFX005
                          by GLFX005
                           
                          Started by XXtrader, Yesterday, 11:30 PM
                          2 responses
                          12 views
                          0 likes
                          Last Post XXtrader  
                          Working...
                          X