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

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

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

          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.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by quantismo, 04-17-2024, 05:13 PM
                      5 responses
                      32 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by proptrade13, Today, 11:06 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by love2code2trade, 04-17-2024, 01:45 PM
                      4 responses
                      34 views
                      0 likes
                      Last Post love2code2trade  
                      Started by cls71, Today, 04:45 AM
                      2 responses
                      10 views
                      0 likes
                      Last Post eDanny
                      by eDanny
                       
                      Started by kulwinder73, Today, 10:31 AM
                      1 response
                      10 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Working...
                      X