Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two Simultaneous Sound Alerts

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

    Two Simultaneous Sound Alerts

    Hello

    My custom strategy has two different signals that usually don't appear at the same time but occasionally this is the case. I use a PlaySound function with a different sound for every signal. This works fine most of the time but when both signals appear at the exact same time, no sound is played at all.

    I was wondering what the simplest way would be to resolve this.

    Thanks

    #2
    laocoon, I would then resort to using the Alerts() method as it would offer assigning different priorities and rearm seconds so they should trigger even if overlapping technically.

    Comment


      #3
      Thanks for the tip Bertrand. I did the modifications and I'm currently testing the new version.

      Comment


        #4
        Hello Bertrand

        I did as you suggested, but for some reason it still doesn't work (when I get 2 simultaneous signals, there's no sound at all). Here's the code:

        Alert("Alert1", NinjaTrader.Cbi.Priority.High, "Long1", "Long1.wav", 1, Color.Black, Color.Yellow);

        Alert("Alert2", NinjaTrader.Cbi.Priority.Medium, "Long2", "Long2.wav", 5, Color.Black, Color.Yellow);

        Any tips on how to solve this would be much appreciated.

        Thanks

        Comment


          #5
          laocoon, so each alert on his own would trigger and work ok? Then they just overlap, an idea here would be just adding some ms delay (silence) into the second sound file used, or more complicated use a timer event to trigger the second alert a tad bit later...

          Comment


            #6
            You can use my SpeakTextHelper functions in Zweistein.Library also for playing audio files

            I am using a threadpool queue to ensure that all incoming sound are played consecutivly and without overlap.


            The library is a by-product of the COTReport Indicator.

            Best regards
            Andreas
            www.zweisteintrading.eu

            Comment


              #7
              Bertrand,

              Thanks for your tip. Yes, each alert on its own triggers and works ok.
              I'll try the delay idea but I'm a bit frustrated because I thought that the Priority setting would take care of the problem.

              Thanks

              Comment


                #8
                Thanks Zweistein, I'll look into it.

                Comment


                  #9
                  @Zweistein: am I right in assuming that in order to get access to the library you're mentioning I'd have to purchase the COTReport Indicator?

                  @ Bertrand: the delay (silence) for the second sound file or even the timer won't solve the problem because I'm using a few different signals that are independent from each other but that can occasionally be triggered at the exact same time in a random combination, ie, Signal 1 can be triggered in conjunction with Signal 3, but the next time it could be Signal 1 combined with Signal 2 etc. Your solution would only work if it was always the SAME pair (combination) of Signals that are triggered together. Isn't there another, straightforward way to solve this issue? (What are the Priority settings for? I thought they were designed to do just that.)

                  Thanks

                  Comment


                    #10
                    Yes, and cotreport will be a one off payment only.

                    Then you can use Zweistein.Library with
                    Zweistein.Speechhelpers.SpeakText(string s);
                    Zweistein,Speechhelpers.SoundFilePlay(string relativepath);


                    regards
                    A.Langhoff

                    Comment


                      #11
                      Hello,

                      Unfortunately there is no straight forward way to solve this and it is a current limitation and needs to be programmed for. The priority action just assigned a color in the Alert window.

                      You would need to use a Timer or introduce time into each sound file. You can also do this with DateTime if the indicator is set to CalculateOnBarClose.

                      Let me know if I can be of further assistance.
                      BrettNinjaTrader Product Management

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by sjsj2732, 03-23-2026, 04:31 AM
                      0 responses
                      42 views
                      0 likes
                      Last Post sjsj2732  
                      Started by NullPointStrategies, 03-13-2026, 05:17 AM
                      0 responses
                      294 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      290 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      135 views
                      1 like
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      98 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Working...
                      X