Announcement

Collapse
No announcement yet.

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.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 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
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X