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

Slope function output

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

    #16
    Gumphrie,
    Yes Thanks. In Ninja its the stock (pre loaded) Linear Regression indicator.

    Here is a Ninja panel from Woodies site

    Thanks
    Attached Files

    Comment


      #17
      OK, to tidy this all up I've attached a new SlopeBox indicator with LSMA and the ability to select the 'SlopeType' calculation used as follows :

      WYS : WhatYouSee - as in the chart based calculation
      WDS : WooDiesSlope - as in the calculation dwalls posted
      NTS : NinjaTraderSlope - as in the output of Slope() converted to degrees as uacvax posted


      ----attachment removed - see later post----
      Last edited by Gumphrie; 08-28-2007, 03:23 PM.

      Comment


        #18
        Wow, very cool.
        Thanks Gumphrie

        By the way, if anyone trys the WoodiesCCIpanel from below, the right hand margin will need to be changed to about 141 or so...as not to cover up the CCI.

        Comment


          #19
          Thanks.

          The WDS calc was wrong, I've updated the attachment.

          Comment


            #20
            Hmm there must be a better way to do the enum stuff. Because you are using a public enum AverageType in your MASlopeBox and because I already have that type in another one of my indicators it creates a conflict between the two indicators and does not allow for me to import your indicator.

            Basically there can only be one instance of
            Code:
            public enum AverageType
            {
                EMA,
                SMA,
                WMA,
            }
            in all of our indicators.

            Also your NTS is producing a constant 0 degrees with sporadic -1 degree erroneous readings.
            Last edited by NinjaTrader_JoshP; 07-17-2007, 05:03 PM.
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              Originally posted by uacvax View Post
              Also your NTS is producing a constant 0 degrees with sporadic -1 degree erroneous readings.
              I know! Its the Slope() output equation you posted dependent on ticksize. How should I modify it? Would you rather it doesn't do the degree convertion in that case?

              Comment


                #22
                Originally posted by uacvax View Post
                Hmm there must be a better way to do the enum stuff. Because you are using a public enum AverageType in your MASlopeBox and because I already have that type in another one of my indicators it creates a conflict between the two indicators and does not allow for me to import your indicator.

                Basically there can only be one instance of
                Code:
                public enum AverageType
                {
                    EMA,
                    SMA,
                    WMA,
                }
                in all of our indicators.

                Also your NTS is producing a constant 0 degrees with sporadic -1 degree erroneous readings.

                You could define any enum/class/type within the scope of another class (e.g. indicator), even as "public" ... BUT this is not recommended by MS due to limitations on the compiled .NET assembly

                -> better go with your current approach of one enum for all indicators.

                Comment


                  #23
                  Hi There,

                  I was seeking a slope indicator (of linear regression), but there doesn't seem to be one in the standard indicators. I then came accross this post in the forum. Unfortunately, when I tried to import it, I got an error that didn't allow the import due to programming errors. I assume this is due to the enum/class issues last posted. Have these issues been resolved and the indicator is posted elsewhere (I couldn't find it with a simple search)? If not, do you have any suggestions around the simplest way to likely fix this challenge to allow import?

                  Thanks,

                  Comment


                    #24
                    Originally posted by Learning1 View Post
                    Hi There,

                    I was seeking a slope indicator (of linear regression), but there doesn't seem to be one in the standard indicators. I then came accross this post in the forum. Unfortunately, when I tried to import it, I got an error that didn't allow the import due to programming errors. I assume this is due to the enum/class issues last posted. Have these issues been resolved and the indicator is posted elsewhere (I couldn't find it with a simple search)? If not, do you have any suggestions around the simplest way to likely fix this challenge to allow import?

                    Thanks,
                    Yes, that's because it conflicts with another indicator you already have installed.

                    This thing is a proof of a concept thing only, so I don't know if its what you looking for. Either way, here is a new version without the conflict.
                    Attached Files

                    Comment


                      #25
                      Thanks Lots Gumphrie!

                      This imported fine and provides a good input for me to play around with in the strategy I'm contemplating. I appreciate the help both on this issue and all the other coding you've done for the forum. I've found a number of your posts / indicators to be very helpful and thought provoking.

                      Thanks Again,

                      Learning1

                      Comment


                        #26
                        Gumphrie,

                        Would it be possible to add a user definable option for the range of bars to use to calculate the slope? I see you have it set to CurrentBar-1.

                        Also could there be a user definable threshold level for for when the slope hits a desired angle that the color changes? That would work with a 3 color plot. A color for negative, nuetral and positive angles, based on the threshold level selected.

                        Thanks,

                        Philip

                        Comment


                          #27
                          Originally posted by pdawg View Post
                          Gumphrie,

                          Would it be possible to add a user definable option for the range of bars to use to calculate the slope? I see you have it set to CurrentBar-1.

                          Also could there be a user definable threshold level for for when the slope hits a desired angle that the color changes? That would work with a 3 color plot. A color for negative, nuetral and positive angles, based on the threshold level selected.

                          Thanks,

                          Philip
                          The bar range is based on the Period of the MA selected. Not sure where you saw CurrentBar-1?

                          Sure there could be. Just change the degrees>0 colour check in the Plot method and hook that into some user properties as needed.

                          Comment


                            #28
                            NTSeries.Set((180/Math.PI) *(Math.Atan(Slope(EMA(Period),CurrentBar-1,CurrentBar))));

                            The range for the MA is different than the range for the slope calc. I like to use CurrentBar-5 for my slope calcs.

                            Comment


                              #29
                              I was looking through this thread, and when it comes to Slope() it does vary it's output depending on tick size as mentioned before. It looks like if you want to normalize the Slope() output no matter what the instrument, you would just divide the slope calc by the TickSize:

                              (Slope(EMA(34),CurrentBar - 5, CurrentBar)/TickSize)

                              Just looking at the output between the YM and ER, that seems to do the trick.

                              Comment


                                #30
                                Gumphrie can you please explain a lil bit on how to utilize that code you posted earlier on "overriding" the Plot Class?? Thank you.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Radano, 06-10-2021, 01:40 AM
                                19 responses
                                606 views
                                0 likes
                                Last Post Radano
                                by Radano
                                 
                                Started by KenneGaray, Today, 03:48 AM
                                0 responses
                                4 views
                                0 likes
                                Last Post KenneGaray  
                                Started by thanajo, 05-04-2021, 02:11 AM
                                4 responses
                                470 views
                                0 likes
                                Last Post tradingnasdaqprueba  
                                Started by aa731, Today, 02:54 AM
                                0 responses
                                5 views
                                0 likes
                                Last Post aa731
                                by aa731
                                 
                                Started by Christopher_R, Today, 12:29 AM
                                0 responses
                                11 views
                                0 likes
                                Last Post Christopher_R  
                                Working...
                                X