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 pechtri, 06-22-2023, 02:31 AM
          9 responses
          122 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by frankthearm, 04-18-2024, 09:08 AM
          16 responses
          66 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by habeebft, Today, 01:18 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by benmarkal, Today, 12:52 PM
          2 responses
          15 views
          0 likes
          Last Post benmarkal  
          Started by f.saeidi, Today, 01:38 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X