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

Stochastics cross

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

    Stochastics cross

    Hello,

    How do you code %K cross below %D with the strategy wizard.

    Will the system trade only when the cross takes place or during the period %K < %D.

    Thank you.

    Kind regards,

    Rene Zeemeijer

    #2
    Hi Rene, if you use the dedicated CrossOver / under functions then the condition would only evaluate to 'true' once a cross is seen, and not just %K being greater then %D or vice versa.

    Please review the 7th section in this link from our helpguide for how to define a CrossOver condition in the wizard - http://www.ninjatrader.com/support/h...on_builder.htm

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      The cross on the K% and D%

      I understand what your saying but instead of creating inputs could i switch the period. My thought process was when %K crosses above %D to go long, but i need to change the variable in order for the code to recognize the difference between %K or D%. Or do i need to simply put


      && CrossAbove(Stochastics(7, (int) (Variable0), (int) (Variable0)).D, Stochastics((int) (Variable1), 14, 3).D, 1))
      {
      EnterLong(1, "");
      }


      Or do i need to simply put as per the the link like the EMA's and MACD and it will read the %K cross above the D%
      && CrossAbove(Stochastics(7, 14, 3).D, Stochastics(7, 14, 3).D, 1))
      {
      EnterLong(1, "");
      }


      Thanks for your help in advance

      Comment


        #4
        Hello, you can use the second call, just make sure you select the correct plot of the Stochastics to use here -

        && CrossAbove(Stochastics(7, 14, 3).K, Stochastics(7, 14, 3).D, 1))
        {
        EnterLong(1, "");
        }
        BertrandNinjaTrader Customer Service

        Comment


          #5
          MACD Crossover, would that be applicable to the MACD

          if (CrossAbove(MACD(12, 26, 9), MACD(12, 26, 9).Avg, 1)

          How would i differentiate the cross on the MACD as was done with the stochastics D &K


          Thanks a bunch

          Comment


            #6
            Should be fine already, you're checking for MACD main value and it's avg here.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by llanqui, Today, 03:53 AM
            0 responses
            4 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            14 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            14 views
            0 likes
            Last Post strategist007  
            Working...
            X