Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

jWilliams2 arrow/sound signal

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

    jWilliams2 arrow/sound signal

    Hi all.

    Working on it for 4 days now with getting nowhere.

    All I try to do is to get one arrow and sound once the jWilliams2 changes color. Unable to get it to plot only once per changed color (arrow+sound under/above the first bar only for up or down and a dot+sound when color changed back to natural)

    If anyone in the community will be able to do it and posted it here or in the share indicators section it will be great and may also serve as a benchmark for creating similar signals/alerts for color changed indicators.

    Thanks in advance,

    Tzachi.

    #2
    Tzachi, what is the code you are using to try to get it to play only once?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,

      See attached. I try to have the jWilliams2 that plot the lines that change colors when rising/falling to add the arrow/sound once for the first bar when its happened.

      It is the jWilliams2 indicator with the DrawArrow and PlaySound addition to plots.

      Cannot get it to work.
      Attached Files

      Comment


        #4
        Tzachi, it looks like you're just checking for Rising() and Falling() conditions, thus the sound would occur every time the bar is rising or falling. You'll have to check for a peak or valley condition instead so it activates just once. Another option would be to use true/false flags to play the sound only after the first rising or falling condition and then reset upon the opposite condition.

        Valley:
        Code:
        if (dataSeries[0] > dataSeries[1] && dataSeries[1] < dataSeries[2])
        // valley, play sound
        A peak would have the opposite signs in the above code.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Austin,

          How and where would you add true/false flags code ?
          Can you please help with this for the indicator in question?

          Thanks.

          Comment


            #6
            If someone has a few minutes and the know how, can you add for me the arrow/sound to plot only once per direction for the first bar when jWilliams2 color changed?

            Working on it for the last few days and still cannot get it to work.
            Thanks in advance.
            Attached Files

            Comment


              #7
              Tzachi, the pseudo-code would look something like this:
              Code:
              bool alreadyRising = false;
              bool alreadyFalling = false;
              
              OnBarUpdate()
              {
                if (Rising(your indicator here))
                {
                  if (!alreadyRising)
                  {
                     // play sound
                  }
                  alreadyFalling = false;
                  alreadyRising = true;
                }
                if (Falling(your indicator))
                {
                   if(!alreadyFalling)
                   {
                      // play sound
                   }
                   alreadyFalling = true;
                   alreadyRising = false;
                }
              }
              AustinNinjaTrader Customer Service

              Comment


                #8
                Austin,

                PERFECT.

                Many thanks.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                591 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                342 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                103 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                555 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                552 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X