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

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
    BertrandNinjaTrader Customer Service

    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.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          6 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Working...
          X