Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            585 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            340 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X