Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Alert not poppin or sound not sounding...

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

    Alert not poppin or sound not sounding...

    Hello, So I'm trying to make a simple alert to remind me when news is coming around. For some reason, it's not sounding, nor is the alert popping up. I've attached the ninjascript file I created with wizard. Also, if there is a way to make the time a user defined input, so I can adjust it when news is coming, that'd be great! Thanks.

    Saul
    Attached Files

    #2
    Hello Saul,

    Thank you for your post and welcome to our forums!

    I added some print statements to your code and I can see that these conditions are being triggered:

    Code:
           // Condition set 1
                if (ToTime(Time[0]) == ToTime(6, 45, 0))
                {
                    Alert("Alert0", Priority.High, "News comin up in 15 min! Stop Trading!", "", 0, Color.DarkRed, Color.White);
                    PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert2.wav");
                    Print("6:45AM");
                }
    
                // Condition set 2
                if (ToTime(Time[0]) == ToTime(8, 10, 0))
                {
                    Alert("Alert1", Priority.High, "News comin up in 15 min! Stop Trading!", "", 0, Color.OrangeRed, Color.White);
                    PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert2.wav");
                    Print("8:10AM");
                }
    
                // Condition set 3
                if (ToTime(Time[0]) == ToTime(5, 50, 0))
                {
                    PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert2.wav");
                    Alert("Alert2", Priority.High, "Test!", "", 0, Color.White, Color.Black);
                    Print("5:50AM");
                }
    If you add something similar to your script, do you see these strings printed to the Tools--> Output window?

    Are you receiving any errors on the Log file of the Control Center around the time they should triggered?

    It would be possible to use custom inputs for the time, however not through the strategy wizard. You would need to unlock the code to add this functionality.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks for the warm welcome Matthew,

      So the output window printed this

      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM
      7:00AM
      8:10AM
      6:45AM

      Immediately after I activated the strategy on a 1 minute chart (since it's set to bar close). Also, I changed it from 5:50 to 7:00 to try and anticipate the time condition, but as you can see, it's not seven and it posted this immediately. I get no errors in the log menu, just no sound or popups in my alert window.

      Comment


        #4
        Hello,

        The prints you are seeing are coming from historical times on the chart.

        You do not need to post an alert and a play sound at the same time. The Alert method will have a sound file over load.

        Please try removing PlaySound() and use only the Alert method and let me know if this does not work for you.
        Attached Files
        MatthewNinjaTrader Product Management

        Comment


          #5
          Yeah, that's the method I had initially, both the sound and alert on the alert condition of the wizard. I only separated them for testing, because the sound wasn't working. Let me try that again though. Thanks Matt

          Comment


            #6
            Ok, so I activated this exact strategy at 7:50 on a 1 minute chart set to go off at 7:55 and nothing popped up on alert window nor did sound emit. I'm wondering, if the alert is set to Sim101, alerts won't activate right? Could that be the problem? It's going live with kinetic, and most of my charts are Sim101, except for my entry chart, which is live with my broker. Should the control center be set to my broker account and not Sim101, even if I'm not using it to enter? Here is my script from wizard...

            " // Condition set 1
            if (ToTime(Time[0]) == ToTime(6, 45, 0))
            {
            Alert("Alert0", Priority.High, "News comin up in 15 min! Stop Trading!", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert3.wav", 0, Color.DarkRed, Color.White);
            }

            // Condition set 2
            if (ToTime(Time[0]) == ToTime(8, 10, 0))
            {
            Alert("Alert1", Priority.High, "News comin up in 15 min! Stop Trading!", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert3.wav", 0, Color.OrangeRed, Color.White);
            }

            // Condition set 3
            if (ToTime(Time[0]) == ToTime(7, 55, 0))
            {
            Alert("Alert2", Priority.High, "Test!", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert3.wav", 0, Color.White, Color.Black);
            }

            }

            #region Properties
            #endregion
            }
            }"

            Comment


              #7
              Hello,

              These functions work here on real-time data and will work on Sim101.

              What symbol are you loading this strategy on?

              Are you sure you have live data with Kinetick or is it possible that it is delayed? Can you check the time stamps for this symbol under File--> New--> Time & Sales
              MatthewNinjaTrader Product Management

              Comment


                #8
                Oh I'm sorry... I meant Zen-Fire... I'm going live with Zen-Fire. When I open the T & S window, it appears blank, but price is definitely moving on my charts. Oh and randomly, my 8:10 Alert did pop up on the window and it made a sound at 8:10 am PT, so I got excited and made another test for 8:25 under condition 3, and still, nothing... It seems it works when it wants to.

                Comment


                  #9
                  Oh and by the way, I'm loading it on NQ 06-12. Sorry missed that question.

                  Saul

                  Comment


                    #10
                    When you sasy you decided to make another test exactly what steps did you do to do this.

                    You needed to compile the new changes. Then right click reload NinjaScript on the chart with the indiactor running on it otherwise it would not change how it is running.

                    -Brett
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      Hey Brett,
                      In the wizard, I had thought that Finishing Compiles it also. I guess not, I'll compile now before finishing. Oh and by the way, I noticed that if I change a script, and restart it, the alerts do go off after the restart. That's weird because every other action works right away, but whatever, at least I know to restart NinjaTrader if it doesn't work. Thanks.

                      Comment


                        #12
                        sound alerts horizonal line

                        where do i find out how to set up audio line alerts on horizona lines plez?

                        Comment


                          #13
                          Hello,

                          There are a few indicators that do this already. You can look at their souce code to see how this was done.

                          LabelHorizontalLines with Alerts - http://www.ninjatrader.com/support/f...d=1&linkid=309

                          Alert for manually drawn lines -
                          MatthewNinjaTrader Product Management

                          Comment


                            #14
                            lines

                            i dont do source code

                            is the there in NT7 a audio alert for horizoanl lines?

                            Comment


                              #15
                              ok i see the scrip[ ti was hoping there was a built in NT indicator for that and had thot that there was

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              656 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              371 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              574 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              579 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X