Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I add the Slope value of a MA to a Strategy

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

    How can I add the Slope value of a MA to a Strategy

    Hello,
    I have found the Slope option on the right side of the Strategy Condition builder wizard, there are settings for the interval the slope will occur in and something else. (I'm at work and don't have access to the NT platform)
    This is from the help guide:
    // Prints the slope of the 20 period simple moving average of the last 10 bars
    Print(Slope(SMA(20), 9, 0));

    I think I undersand this, what I would like is to test true for a slope of zero. This will occur at the bottom or top of a MA as the market goes thru a price swing. So on the left side from my MA parameters I would select MA falling and on the right side I would like to have slope = zero as a condition, when true this would trigger the strategy.
    Can you give me an example of how to use the wizard to accomplish this?
    Thank you,
    John

    #2
    John,

    For that you would actually set up two separate conditions. One is to check if the plot is rising/falling vs true/false. So left hand side is Falling and right hand side is either true/false depending on what you want.

    Second condition = slope on left hand side and on right hand side = Numeric Value from the Misc category. The numeric value would then be 0.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh,
      I will be studying the Strategy wizards tonight. Would you please post a link or a more detailed example of implementing this? I get a boolian error when I try to have a MA==falling.
      Thanks,
      John

      Comment


        #4
        John,

        You cannot compare an MA to falling.
        You need to select Falling on the left hand side, then in the Parameters for falling, select the MA series you want to check for falling. Then on the right hand side you want to select true or false.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          So far so good with your previous help, I can get a true condition in a strategy which detects a falling or rising MA, I am not able to tie this to a slope value = 0 because the falling condition needs to be 1 bar ago, you cannot have a falling MA and a MA slope of 0 at the same time. I do not see a way to have a condition set to 1 bar ago on the falling MA.
          Thanks for the help,
          John
          Last edited by JohnPS; 10-16-2009, 12:27 PM.

          Comment


            #6
            Right. You cannot check for Rising/Falling for previous bar. To do so requires custom programming.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              New Question,
              I have a custom indicator that paints a colored dot at support and resistance, can a strategy be set to be true for the 1st painting of the dot? In this case a red dot would be support and would trigger a buy and vise versa with a resistance dot for sell. Or is the code that generates the dot that would be the trigger?
              Thanks,
              JohnPS

              Comment


                #8
                The code that generates the dot would be the trigger. Otherwise you could set some public bool that tracks the state of whether you drew the dot or not.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  I am writing a strategy where if the bar closes above the moving average then enter Long. I have 1 user input which is the MA, it is the base line, when a bar closes above the base line, enter Long. I tried using Price Data and the open. This is what the code in the wizard looks like: Open(0)>MA14, no good, it sells short on the 2nd full bar of data and then nothing more. I also added code that the MA must be rising, MA(14,0). Up(0)>MA(14,0).Up(1). Still no good. The sell side is the reverse of the above, Open(0)<MA14.
                  What would be an example that works that I could view in the strategy wizard?
                  Any help is appreciated,
                  John
                  Last edited by JohnPS; 04-14-2010, 04:56 AM.

                  Comment


                    #10
                    John,

                    You will want to use Close[0] instead of Open[0]. Replace Open[0] with the close Price data and let me know if this give you the results your looking for. I have attached an example of what this would look like.

                    Let me know if I can be of further assistance.
                    Attached Files

                    Comment


                      #11
                      Thank you.
                      i think what I need is
                      Close(0)>SMA(14)(0) and
                      Open(0)>SMA(14)(0)

                      this will give a signal based on the entire bar being above the SMA which is what I am looking for.
                      Is this how Bar commands are written? The condition in words that I am looking for is: enter long when a 5 min bar closes above the SMA(14).
                      Thanks

                      Comment


                        #12
                        Remember that in backtesting NinjaTrader will always submit the order on the open of the next bar once the condition is true to Enter a position. This means that If the condition becomes true on bar 1, the order is submitted on the open of bar 2.



                        Let me know if I can be of further assistance.

                        Comment


                          #13
                          Because of recent exposure to the value of the CCI, it is a great leading indicator, I would like to use the CCIMA from the Ninja downloads. Being a MA of the CCI it smooths the jaggedness of the CCI so it is easier on the eyes, it lags a bit but CCI is ahead of the MA's of any kind, so some lag here will still give a timely signal. To make the CCIMA better yet it would be best to use a faster means of creating the MA. How can i incorporate the EMA into the CCIMA, possibly give a selection of SMA, EMA and HMA? Is there a general tutorial on how to enhance an indicator in this way?
                          Thank you,
                          John

                          Comment


                            #14
                            Hello,

                            If you were to use NinjaTrader 7 there would be no need custom code this as you can now do this in NinjaTrader. If you still would like information on how you custom code this please let me know.

                            With NinjaTrader 7, you can do this by adding an EMA indicator your chart and changing the input series to the indicator CCI. Thus smoothing the CCI indicator with an EMA and instantly displaying it to the chart.

                            If you do not have NinjaTrader 7 you can download it at our download page. You can install both NinjaTrader 6.5 and NinjaTrader 7 on the same computer if you have not installed NinjaTrader 7.



                            Let me know if I can be of further assistance.

                            Comment


                              #15
                              OK - this is very cool, Thanks. Is there any great difficulty migrating from 6.5 to 7? I have several indicators at 6.5 that I am very fond of. Also, I have a proprietary moving average that is part of my preferred indicator set, will it work in 7, and if it does, will it appear in the available moving average selections in the CCIMA?
                              Thanks,
                              John
                              Last edited by JohnPS; 06-14-2010, 12:21 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Shai Samuel, 07-02-2022, 02:46 PM
                              4 responses
                              94 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Started by DJ888, Yesterday, 10:57 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by MacDad, 02-25-2024, 11:48 PM
                              7 responses
                              158 views
                              0 likes
                              Last Post loganjarosz123  
                              Started by Belfortbucks, Yesterday, 09:29 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post Belfortbucks  
                              Started by zstheorist, Yesterday, 07:52 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post zstheorist  
                              Working...
                              X