Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Difference of an moving average

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

    Difference of an moving average

    Is there an indicator or a way to determone in a strategy wizzard what the difference between the current bar and the previous bar of an Moving average, either by slope or price. For example let us suppose that the following;

    ES
    Current Bar MA's value = 1279.42 and
    1 bar ago MA's value was 1279.40
    the difference is 0.02

    Similarly we can express the same in slope

    Current Bar MA's slope value = 2 degrees and
    1 bar ago MA's slope value = 2 degrees

    the difference is 0 degrees there for I know the MA line is flat

    I have searched and tried different available indicators but can not compare 2 bars for the above information.

    Basically I want to know when the MA is flat in a way that I can use in a strategy.

    Any help would be appriciated
    Thanks

    #2
    Hello tomonly23,
    Thanks for your post and I am happy to assist you.

    In the Strategy wizard goto Conditions and Actions page. Click on Add in the conditions box. The Condition Builder pops up. In the left pane Click on +Misc, and select Slope.
    In the parameter box below, select the Series
    In the series dialog box select Indicator>SMA or Price data> Close (or High, low etc).

    Set Start bar to 1 and End bar to 0.

    In the right pane Click Misc> Numeric value, Set value to 0 in the parameters box below and Click Ok.

    This will help you compare SMA/Price.

    Do let me know if I can be of any further assistance.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Re: Slope

      Thanks for the reply,

      The Slope of a MA will not likely stay on 0 (which is flat) for more than 1 or 2 bars, and since I can not plot the slope function on a chart to see whether its value is in degrees or not I can not figure out the difference on a bar to bar basis.

      For instance lets suppose that an acceptable slope for a condition is less than 5 degees or greater than -5 degrees.

      How do I do that?

      Thanks

      Comment


        #4
        Hello tomonly23,
        You do it exactly the same way, except for you Add 2 conditions and choose the “>” and “<” value instead of the “==” from the drop down menu in the middle of the 2 panes in the Condition builder.

        So it will be like
        In the Strategy wizard goto Conditions and Actions page. Click on Add in the conditions box. The Condition Builder pops up. In the left pane Click on +Misc, and select Slope.
        In the parameter box below, select the Series
        In the series dialog box select Indicator>SMA or Price data> Close (or High, low etc).

        Set Start bar to 1 and End bar to 0.

        In the right pane Click +Misc>Numeric value, Set value to 5 in the parameters box below and
        In the dropdown menu in the middle of the 2 panes select “<”


        Click Ok.

        Click Add again in the conditions and action page. Repeat the above process, except for the last part highlighted in bold. Replace the same with

        In the right pane Click +Misc>Numeric value, Set value to -5 (mind the minus) in the parameters box below and
        In the dropdown menu in the middle of the 2 panes select “>

        Click Ok.

        This should get you a value in between 5 and -5

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Thank You for your help

          Comment


            #6
            Hello tomonly23,
            Glad to know you could get it work.

            Have a nice weekend.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Hello and a great thank you for supporting

              I was searching exactly the same as it's mentioned above, but i won't use it in a ninjascript auto-strategy...I just need the numeric value of the moving average slope (exactly as you described) to be ploted as an indicator in my charts, and not as a condition in a ninjascript strategy. I guess i have to code this as an indicator...but i have no idea how to do that.

              ps. The first thing i was searching it was the true angle of the SMA...but then i realised that if i zoomk in/out in my chart or when it autoscales as time goes by, then the angle will be also changing...Is that right? so now I'm looking for the slope measurement as you described but ploted in my charts as a histogram with zero line=flat moving average between x candles


              Any help?

              Comment


                #8
                Hello skiron,
                Welcome to the forum and I am happy to assist you.

                You may refer to this post which demonstrates how to calculate the angle.
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  thanks for the quick reply.
                  the post you mentioned refers to the actual angle....what i need is:

                  price of moving average in bar0 - price of moving average in x bars ago = y

                  and the y value to be ploted as an indicator in my chart like a histogram


                  The same way Tomonly described but not for using as a strategy condition, but as an indi.

                  is that possible via ninjascrip indicator builder? I don't have coding skills.....

                  Comment


                    #10
                    Hello skiron,
                    Unfortunately it is not possible to do it via the wizard.

                    To develop your custom indicator/strategies you can contact any of our independent NinjaScript consultants. You can get the list of our NinjaScript consultants from here http://www.ninjatrader.com/partners#...pt-Consultants
                    JoydeepNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Max238, Today, 01:28 AM
                    1 response
                    23 views
                    0 likes
                    Last Post CactusMan  
                    Started by giulyko00, Yesterday, 12:03 PM
                    2 responses
                    10 views
                    0 likes
                    Last Post giulyko00  
                    Started by r68cervera, Today, 05:29 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post r68cervera  
                    Started by geddyisodin, Today, 05:20 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post geddyisodin  
                    Started by JonesJoker, 04-22-2024, 12:23 PM
                    6 responses
                    38 views
                    0 likes
                    Last Post JonesJoker  
                    Working...
                    X