Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need to Set up a Stochastics Alarm

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

    Need to Set up a Stochastics Alarm

    I know how to set up period D crossing above/below period K, but is there a way to set an alarm when the Stochastics Period-D rises or falls below the 50 (median) line in Ninjascript?

    #2
    RookieTrader, yes you could code this up via using the Alert method after your condition or by setting this up as strategy in our wizard -



    Comment


      #3
      Bertrand,

      Thanks for the response. I didn't see any coding on how to set up a Stochastics alert, but I tried a couple of different ways though. I tried “D” crossing above/below “K” and I tried the user defined inputs and numeric values (see below), but it still isn’t working. I’m sure it’s something simple I not seeing. Are you able to determine from the data below what the issue is?

      __________________________________________________ ________
      {
      // Condition set 1
      if (CrossAbove(Stochastics(1, 3, 2).D, Stochastics(1, 3, 2).K, 1))
      {
      Alert("MyAlert3", Priority.High, "", "", 0, Color.White, Color.Black);
      }

      // Condition set 2
      if (CrossBelow(Stochastics(1, 3, 2).D, Stochastics(1, 3, 2).K, 1))
      {
      Alert("MyAlert1", Priority.High, "", "", 0, Color.White, Color.Black);
      }


      - AND –



      {
      // Condition set 1
      if (Stochastics(1, 3, 2).D[0] > Median50)
      {
      Alert("Alert3", Priority.High, "", "", 0, Color.White, Color.Black);
      }

      // Condition set 2
      if (Stochastics(1, 3, 2).D[0] < 50)
      {
      Alert("Alert1", Priority.High, "", "", 0, Color.White, Color.Black);
      }

      __________________________________________________ ____________________

      Comment


        #4
        Hello RookieTrader,

        From the descrption of your first post, it seems like you want to be alerted when the d crosses 50. On the right side of the condition builder select Misc > Numeric value > type in 50.

        The snippets below are closer to this:

        Code:
         
        // Condition set 1
        if (CrossAbove(Stochastics(7, 14, 3).D, 50, 1))
        {
        Alert("MyAlert0", Priority.High, "", "", 0, Color.White, Color.Black);
        }
        // Condition set 2
        if (CrossBelow(Stochastics(7, 14, 3).D, 50, 1))
        {
        Alert("MyAlert1", Priority.High, "", "", 0, Color.White, Color.Black);
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          RyanM,

          I tested it and that did the trick. Thanks for your help.

          Comment


            #6
            Glad to hear it's now working to your expectations. Thanks for the update!
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            574 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X