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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            64 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            35 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            59 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            51 views
            0 likes
            Last Post CarlTrading  
            Working...
            X