Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

still confused, PlaySound still repeating

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

    still confused, PlaySound still repeating

    could you please send to to the proper documentation to figure out how to code the count down thing or whatever i need to get my PlaySound to only fire once. i'm having a 10min stoch get triggered in a 2min chat so the sound file gets played on close of each of the 2 min bars till a new 10min bar gets started.


    // Condition set 3
    if (CrossBelow(Stochastics(BarsArray[1],3, 10, 3).K, 80,1))
    {
    PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav");

    }

    sorry, i know this gets asked a lot but i couldn't find the link to the answer

    #2
    You can either use a bool flag to call it only once and then reset the flag on the OnBarUpdate() of the larger series, or you use Alert() and set a high 'rearm' time - http://www.ninjatrader-support.com/H...eV6/Alert.html

    Comment


      #3
      could you point me to any sample code of setting a high rearm time? what it would look like specifically, i'm kind lame and really need to see what it is supposed to look like. thanks for the quick answer

      Comment


        #4
        better yet where can i learn about the bool flag thing? is there a link for that?

        Comment


          #5
          You can see an Alert() example in the helpguide link I pasted in, it basically set the seconds how long an alert triggered will be ignored before it's rearmed again to fire.

          The bool flag is really just a common programming concept taking advantage of a boolean variable can either be true or false, like a switch. You can then for example do things like this below -

          if (myCondition1 and boolFlag = true)
          Do this...
          boolFlag = false;

          if (myCondition2)
          boolFlag = true;

          Your condition2 resets to boolFlag to enable condition1 to trigger an action again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X