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

Concurrent alerts

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

    Concurrent alerts

    Hi guys. I'm trying to play dual alerts without much success. What I'm trying to do is play a loud sound alert so I can hear if clearly from downstairs. Then after it plays the sound alert in this case an ahooga horn, it will play a voice activated alert specific to the relevant instrument. I am using COBC = false and have found information from another post to make sure it only alerts once per bar. The following test code works flawlessly with only one play sound/alert. The problem is when I put in the second instrument specific alert (the line actually commented out "ESAlert.wav) it actually skips the first ahooga alert totally and plays the second alert and also on every tick. So does anybody know how to play two sounds consecutively, one after the other but keeping a single alert every bar?

    #region Variables

    private bool boolAlertSounded = false;

    protected override void OnBarUpdate()

    if (FirstTickOfBar) boolAlertSounded = false; //reset the bool flag at the start of the bar

    if (Open[0]>Open[1])
    {
    DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0], Color.Lime);
    if (!boolAlertSounded)
    PlaySound("ahooga.wav");
    //PlaySound("ESAlert.wav");
    boolAlertSounded = true; // set the bool flag to stop sound play
    }

    Thanks in advance
    DJ

    #2
    Hello,

    Thanks for the forum post.

    You need a way to get that playsound on the second alert out a bit.

    I believe whats happening is your

    PlaySound(File1) at second 1

    PlaySound(File2) at second 1.05ms.

    Which then cuts off File1 play since it playing the second sound too soon.

    Options are to let this run on First Tick of the Bar on each bar, this would seperate out the play time a bit.

    You other option is a bit unsupported and that is to use a Timer windows object. You would be on your own to do this however with the below method. I have no samples on how you would do this but you would use your own event and a timer to space the sound activation out.




    Lastly the third option is to make new .Wav files with the loud sound and softer sound all in one file.

    Let me know if I can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rocketman7, Today, 02:12 AM
    5 responses
    23 views
    0 likes
    Last Post rocketman7  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    7 responses
    28 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by samish18, 04-17-2024, 08:57 AM
    17 responses
    66 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by briansaul, Today, 05:31 AM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by PaulMohn, Today, 03:49 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X