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

No sound on PlaySound() and Alert not working

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

    No sound on PlaySound() and Alert not working

    Hi,

    in my indicator when I detect a signal, I have the following code :

    PlaySound("test.wav");
    Print(Instrument.MasterInstrument.Name+" - found 2TL");
    Alert("2Tl", NinjaTrader.Cbi.Priority.High, "2TL Found", "test.wav", 1, Color.Black, Color.Yellow);

    The print statement prints correctly in the output window, but there is no sound from Playsound() and the Alert seems to do nothing. There are no error messages in the output window. The sound files have been placed in the install/Sounds folder, and I have also tried using absolute path names.

    What could I be doing wrong?

    Thanks.

    #2
    Hello dontpanic,

    Thank you for your post.

    You need to specify the exact file location with 'PlaySound().

    For example, PlaySound(@"C:\mySound.wav");

    If your test.wav is in the NinjaTrader\sounds directory, please specify the exact path:

    Code:
    PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\test.wav");
    MatthewNinjaTrader Product Management

    Comment


      #3
      I think I found the error, came across another post; I'm not using a PCM file. I didnt realise the Log TAB is different to the output window. This will (hopefully) explain why there is no Playsound, and maybe causing the Alert to fail as well.

      Comment


        #4
        Thanks Mathew, as I mentioned in my post (perhaps not clearly enough) I had tried using absolute paths as well, as you suggested. I just realise I'm not using a PCM file, so trying that now.

        Comment


          #5
          How do you post a "thanks" here?

          Comment


            #6
            Hi,

            Thanks for the clarification - that would likely the be case, but let me know if you have further issues.

            Can you select thanks at the bottom of any individual reply.
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            6 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            9 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            20 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X