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

Stochastic Strategy Build

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

    Stochastic Strategy Build

    I'm brand new to this, so please forgive my ignorance.

    I need a simple strategy built on the default Stochastics Indicator in the Ninja Trader Indicator files.

    Just need it to trigger a buy when the fast crosses up thru the slow, and vice versa.

    Does anyone have anything like this they would be willing to share?

    Thanks,

    #2
    You could use the Strategy Wizard to build this yourself.

    Please see the Help Guide on Strategy Wizard for some guidance.
    RayNinjaTrader Customer Service

    Comment


      #3
      Understand...

      If some kind soul does not help, you have the following options -

      - Contract out to a NinjaScript Consultant - http://www.ninjatrader.com/webnew/pa...injaScript.htm

      - Attend our upcoming course on strategy development geared for non-programmers - http://www.ninjatrader.com/webnew/ev...evelopment.htm
      RayNinjaTrader Customer Service

      Comment


        #4
        Same question: I understand how to use the strategy wizard to choose a value from the left side and test for a cross over with a value from the right. The question is: with the stochastics indicator, both the K and D values are in the same indicator, so how do I specify a crossover for one over the other; that is how do I specify either the K or D on the left and the other on the right.
        Ted

        Comment


          #5
          Hello,

          Select K or D in the Plot. See screen shot attached.
          Attached Files
          DenNinjaTrader Customer Service

          Comment


            #6
            Thanks, Ben.
            Ted

            Comment


              #7
              I know this is an old thread, but I am just getting into this. I set this very same strategy up and it works the way I want it to. The only problem is that when I get K crossing D on a uptrend then it immediately turns south, it does not want to exit out till sometime later way down the line. I figured I would put ina stop loss through the wizard for say 2 ticks but then it just makes the profit gains ALOT worse. Am I doing something wrong?

              No stop loss


              with stop loss


              Seems with the stop loss, I got tons more stop loss than I do profit gains

              Comment


                #8
                Hello bughatti,

                Thank you for writing in.

                Can you please explain your expected result?

                You have set a stop loss through the strategy wizard, the stop loss is triggered and exits your position.

                The strategy enters again later and then is stopped out by your stop loss.

                Have you set a profit target to exit with profit?
                Zachary G.NinjaTrader Customer Service

                Comment


                  #9
                  Yea I see your point, since I am new to this that piece did not occur to me till this morning when I went back and looked at it. Yes I did set a profit target of 5 ticks and that piece works. So I guess in the grand scheme of it the strategy works great during an uptrend but completely backfires when it hits a down trend. I guess I need to do some more research on how to code it to handle a a reversal of the market and sell short with a profit of 5 ticks. Is their any piece in the wizard that I can add that detects a uptrend or downtrend?

                  Comment


                    #10
                    Hello bughatti,

                    There is no one piece of code in the Strategy Wizard that would automatically do this for you.

                    You would need to manually check for this yourself.

                    For one of the condition sets, you can check for a three bar uptrend, for example, by doing the following:
                    • Click Add for the "When the following conditions are true" section
                    • On the left side of the condition builder, select Price data -> Close
                    • Ensure the "Bars ago" parameter is set to 0
                    • Select ">" for the comparison operator in the center drop down menu
                    • On the right side of the condition builder, select Price data -> Close
                    • Ensure the "Bars ago" parameter is set to 1
                    • Click OK
                    • Then, click Add again for the "When the following conditions are true" section
                    • Price data -> Close -> Bars ago set to 1 for the left side
                    • Select ">" for the comparison operator
                    • Price data -> Close -> Bars ago set to 2 for the right side
                    • Click OK
                    • Then, click Add again for the "When the following conditions are true" section
                    • Price data -> Close -> Bars ago set to 2 for the left side
                    • Select ">" for the comparison operator
                    • Price data -> Close -> Bars ago set to 3 for the right side
                    • Click OK


                    You should see the following in the "When the following conditions are true" section:
                    Code:
                    Close[0] > Close[1]
                    Close[1] > Close[2]
                    Close[2] > Close[3]
                    This is basically going to check if the current close is greater than the previous close (one bar ago) AND if the previous close is greater than the close previous to that (two bars ago) AND if the close of two bars ago is greater than the close of three bars ago.

                    You can then set your actions in the "Do the following" section.
                    Zachary G.NinjaTrader Customer Service

                    Comment


                      #11
                      Ok that worked the way I wanted, thanks. Now using the Stochastic I can get a signal on D Crossing K and then check for 2 bars higher but how can I get Stochastic to only indicate below 20 or above 80, is that possible?

                      Comment


                        #12
                        Hello bughatti,

                        Can you please clarify what you mean about having the Stochastics only "indicate" below 20 or above 80?

                        Are you wanting to check if the Stochastics indicator's D or K plot is below 20 or above 80 and if so, do something?

                        You'll have to create two sets for this. Unfortunately, with the Strategy Wizard, you cannot use an OR conditional in each set. They will only be AND conditionals.

                        For one set, select the Stochastics indicator on the left side of the Condition Builder. Select < for the comparison operator. On the right side of the Condition Builder, select Misc -> Numeric value and set this to 20.

                        You'll do the same for the other set, but instead use a > for the comparison operator and the numeric value set to 80.
                        Zachary G.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by kempotrader, Today, 08:56 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post kempotrader  
                        Started by kempotrader, Today, 08:54 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post kempotrader  
                        Started by mmenigma, Today, 08:54 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post mmenigma  
                        Started by halgo_boulder, Today, 08:44 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post halgo_boulder  
                        Started by drewski1980, Today, 08:24 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post drewski1980  
                        Working...
                        X