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

    #46
    Hello,
    Great indicator. Thanks.
    I have a couple questions:
    1) Is MASlopeBox the same as MASlopeBoxMulti?
    2) Could you possibly and that new Zero Lag EMA to the drop down list?

    Thanks,
    dwalls

    Comment


      #47
      Originally posted by dwalls View Post
      Hello,
      Great indicator. Thanks.
      I have a couple questions:
      1) Is MASlopeBox the same as MASlopeBoxMulti?
      2) Could you possibly and that new Zero Lag EMA to the drop down list?

      Thanks,
      dwalls
      No they are different. Because they use the same public variables, you'd have to delete MASlopeBox before adding the multi version and vice-versa.

      MASlopeBox is the original made by Gumphrie, and MASlopeBoxMulti is my tweaked version which supports more MA types, allows you to use more than one instance (with the original the boxes would overlap), and also the color of the slope box matches the color of the MA plot whereas in the original the slope boxes would all be lime green and red, matching the color of the degrees font, making it more difficult to know which box is for which slope.

      As for the zero lag MA, I plan to add that as well as KAMA, MAMA and VMA types, but that requires a bit more tweaking because those moving average types have more than one input parameter.

      The NonLagMA for example has 5 parameters where the other MA types only have one. It shouldn't be hard to add basic support for those types, but initially only the period parameter would be user definable from the dialog.

      I'll work on that later tonight.
      Last edited by Elliott Wave; 04-17-2008, 04:18 PM.

      Comment


        #48
        The MASlopeBox now supports 4 new MA types for 13 in total:

        VOLMA (Volume Moving Average, only works with WYS slope type)
        VMA (Variable Moving Average)
        KAMA (Kaufman Moving Average)
        NONLAGMA (Zi NonLag Moving Average)

        The KAMA has 3 parameters fast, period and slow, with the defaults being 2, 10, 30. To keep the same ratio without complicating the indicator too much the fast period is automatically calculated as 0.2 x the period, and the slow as 3 x the period set in the parameters box.

        For the VMA period and volatility period default to the same so one value is used.

        The NonLagMA is the most complex so I just left all the variables to the default with only the period being changed.
        Attached Files
        Last edited by Elliott Wave; 04-18-2008, 02:29 PM.

        Comment


          #49
          Elliot Wave,
          I was accually preferring to the Zero Lagging EMA. It is the last indicator found at the bottom of page 7 in the Indicators section in this forum. Maybe see if it would be easier to use than the ZI NonLag Moving Average you are currently using, found on page 5.
          fwiw

          thanks

          Comment


            #50
            Ok I see the one you are talking about.

            It is definitely simpler as it only has one parameter.

            I'll have to look into it and see what the differences are.

            ---------------------

            I've added the ZeroLagEMA. Also on the advice of Gumphrie I changed the public enums, which fixes the conflict between the multi version and the original.

            I think that pretty much covers all the moving average types.

            Hopefully in the near future a degrees plot will be added, allowing the indicator to be used with automated strategies. It may take a little while though...
            Attached Files
            Last edited by Elliott Wave; 04-18-2008, 02:20 PM.

            Comment


              #51
              Hi Elliott,

              This is really great!

              I am developing some strategies using MAs and I wonder if it is possible to have each MA assigned with a number. With something like this we could run a strategy optimization and see which is the best MA.

              Cheers,

              Comment


                #52
                You can try using a switch-case design on your code and just change between MAs. Then you can backtest each different variant and decide which you like the best.
                Josh P.NinjaTrader Customer Service

                Comment


                  #53
                  so has anyone found a way to use the output in a strategy yet?? I just found this and agree this could be an amazing indicator

                  Comment


                    #54
                    Originally posted by Josh View Post
                    You can try using a switch-case design on your code and just change between MAs. Then you can backtest each different variant and decide which you like the best.
                    Thanks, but I don't have enough knowledge programming L

                    Maybe someone can help with this.

                    cheers

                    Comment


                      #55
                      Check this out. http://www.csharp-station.com/Tutorials/Lesson03.aspx
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #56
                        Can anyone explain the slope() function in ninja a little for me, i have read the manual, and tried to use it but to no avail. I really dont understand what it it outputting.

                        Comment


                          #57
                          It returns the slope as calculated by rise over run. Here is some further data - http://www.purplemath.com/modules/slopgrph.htm
                          RayNinjaTrader Customer Service

                          Comment


                            #58
                            So the slope is calculated in radians, from -1 to 1. Is there a specific reason why ninja could not have put what .10 or -.10 means in terms of degrees somewhere in documentaion. Ok so anyhoo, gonna do some googleing and see if i can figure it out, thanks for great software

                            Comment


                              #59
                              Ok since I have been told ninja wont output radians larger than 1 or less than -1 this is what i am getting for what radians mena decimal wise, please let me know if i am wrong

                              1 Radian = 57.29 degrees
                              .95 radian = 54.4 degrees
                              .90 radian = 51.5 degrees
                              .80 = 45.8
                              .70 = 40.10
                              .60 = 34.3
                              .50 = 28.6
                              .40 = 22.9
                              .30 = 17.18
                              .20 = 11.45
                              .10 = 5.72
                              .05 = 2.86

                              i am guessing 0 is flat line

                              - radians are the exact opposite, now a question i have is a positive radian, so what plane is zero at. is taht the horizontal plane?? or vertical plane


                              One thing to understand about a radian is that it is bigger than a degree. In fact:
                              1 radian = 57.2957 degrees
                              1 degree = 0.0174532 radians


                              So atleast for me if u want to use the slope function in the wizard, use the MAmultislopebox indictor and look at see waht angle u want to see, the take that angle and multiply it by the measurment of .0174532 and use that in the wizard, i think dont know if this helps anyone for using this in a strategy but i think its gonna help me
                              Last edited by timmyb; 04-23-2008, 06:48 PM.

                              Comment


                                #60
                                Ok i am obvioulsy not a ninja expert, but i am trying my best, I realize i must be way off base, but in a attempt to get this indicator to work under strategies this is where i have gotten,

                                I added another plot here:



                                [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                                [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                                public DataSeries Degrees

                                {
                                get { return Values [0]; }
                                }

                                I named it Degrees

                                I tried to get the (int) number needed from here this way:

                                if (haveLabel)
                                {
                                switch (MySlopeType)
                                {
                                case SlopeTypeMulti.WYS:
                                degrees=(
                                int)wysSlope;
                                Degrees.Set(
                                0,(int)wysSlope);
                                break;
                                case SlopeTypeMulti.WDS:
                                degrees=(
                                int)wdsSlope;
                                Degrees.Set(
                                0,(int)wdsSlope);
                                break;
                                case SlopeTypeMulti.NTS:
                                degrees=(
                                int)ntsSlope;
                                Degrees.Set(
                                0,(int)ntsSlope);
                                break;


                                Now what i see wrong is that i am trying to get the value from in the plot section, i dunno if this is the wrong way or not, but basically depending on the selection here it displays the degrees in the little box on the chart. So i typed Degrees.Set and used the same info they have. And well i get no trades when using the plot of degrees, I then tried to "Degrees.Set" here:
                                protectedoverridevoid OnBarUpdate()
                                {
                                if (CurrentBar < 2) return;
                                switch (MyAverageType)
                                {
                                case SlopeBoxMultiAverageType.SMA:
                                Plot0.Set(SMA(Period)[
                                0]);
                                NTSeries.Set((
                                180/Math.PI) *(Math.Atan(Slope(SMA(Period),1,0))));
                                Degrees.Set((
                                180/Math.PI) *(Math.Atan(Slope(SMA(Period),1,0))));

                                since i figured that where it all starts, it then will get a numerical value but nothing close to what appears right when using teh indicator.

                                Well no expert am I but hey its a good learning lesson, if anyone has input just let me know. It appears allot of people would love to have this indicator and use it in strategies myself included.




                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by gravdigaz6, Today, 11:40 PM
                                1 response
                                7 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by MarianApalaghiei, Today, 10:49 PM
                                3 responses
                                10 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by XXtrader, Today, 11:30 PM
                                0 responses
                                4 views
                                0 likes
                                Last Post XXtrader  
                                Started by love2code2trade, Yesterday, 01:45 PM
                                4 responses
                                28 views
                                0 likes
                                Last Post love2code2trade  
                                Started by funk10101, Today, 09:43 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post funk10101  
                                Working...
                                X