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 algospoke, 04-17-2024, 06:40 PM
            6 responses
            49 views
            0 likes
            Last Post algospoke  
            Started by arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            61 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            11 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            21 views
            0 likes
            Last Post traderqz  
            Working...
            X