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

Adding Text Strings to Sound Alerts

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

    Adding Text Strings to Sound Alerts

    How to add the instrument name or any other text to a sound alert?

    For example a generic sound alert will alert of a crossover generated by a crossover indicator (i.e. a moving average, etc.) on a chart. What is a simple script for adding the name of the instrument on the chart to the alert sound file?

    #2
    Hello,

    Thank you for the question.

    If you are asking how to add the instrument name in text to an Alert then you can use:

    Code:
    Instrument.FullName
    There is also Instrument.Name but this does not get the futures contact date.

    I was confused with your wording, it sounds like you want a sound of the instrument name which NinjaTrader would not be capable of currently, if this is not the case please ignore this.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse,

      Let's say an AT&T sound file would alert something like "Moving Average Crossover."

      If this sound file is used for different open charts of two or three instruments, it will not be clear which instrument initiated the alert.

      However, NT script can be written to add the name of the instrument to the sound file so that the Alert would sound something like "ES" "Moving Average Crossover."

      I have previously seen examples of NT7 code to that effect, however I can not locate it using your forum search.

      Thanks again.
      Last edited by aligator; 03-20-2015, 08:36 AM.

      Comment


        #4
        Hello,

        Thank you for the reply.

        So if you have a method of creating your own sound files such as the ATT labs website, then these could be used with NinjaTrader as long as it is a WAV file.

        To do this you would need to place the WAV files in the folder: C:\Program Files (x86)\NinjaTrader 7\sounds

        They don't absolutely need to be in this folder it just makes the alert code easier.

        Now if you have placed the files in the folder above, you can then just use the name of the file as you currently do in the alert. Otherwise if you do not place then in the folder, you will need to provide an entire path to the file using the following format:
        @"C:\filename.wav"

        The @ is required because you will have backslashes in the path.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks Jesse.

          This is pretty much what I meant and currently do, creating custom sound files on AT&T Lab for different instruments and use for that instrument. But this is a tedious task If you want to run an alert on a list of stocks like SP500 or Russell 2000, you would need that many custom sound files.

          However, only one sound file is necessary + the required NT script for the "Name" added in the code and be called by any indicator . This way there is no need for many custom sound files, one fits all and will simply alert for whatever instrument is on the chart based on the "Name" of the instrument.

          The one or two lines script for NT has already been done on the forum, if it can be located.

          Thanks again.

          Comment


            #6
            Hello,

            Thank you for the reply.

            Yes this would probably be the best out of the box method for Ninjatrader because there is by default no text to speech built in.

            I have never seen the post you are referring to myself so unfortunately I wouldn't be much help in that aspect.


            What could be done is a use of the C# SpeechSynthesizer class.

            This would be more of an advanced programming item and is definitely not supported, but if you would like I could post on how to use this with NinjaScript to do text to speech.



            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Thank you Jesse,

              Since NT does not have text to speech, how about this idea for showing the name of the instrument inside a Alert window:

              What is the text modification to the following NT alert code to simply print the name of the instrument before the message in " "?

              Alert ("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);

              i.e. Alert should print : "CL Reacched threshold"

              Many Thanks.



              Originally posted by NinjaTrader_Jesse View Post
              Hello,

              Thank you for the reply.

              Yes this would probably be the best out of the box method for Ninjatrader because there is by default no text to speech built in.

              I have never seen the post you are referring to myself so unfortunately I wouldn't be much help in that aspect.


              What could be done is a use of the C# SpeechSynthesizer class.

              This would be more of an advanced programming item and is definitely not supported, but if you would like I could post on how to use this with NinjaScript to do text to speech.



              I look forward to being of further assistance.

              Comment


                #8
                Hello,

                To get the instrument name you have two ways, for futures specifically.

                Code:
                Instrument.FullName
                This will give you the entire name or ES 06-15 for example.

                Or there is

                Code:
                Instrument.MasterInstrument.Name
                Which only gets the instrument or ES for example.

                I look forward to being of further assistance.
                Last edited by NinjaTrader_Jesse; 03-27-2015, 11:01 AM.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Thanks a bunch Jesse:

                  Would you please show how and where
                  Code:
                  Instrument.Name
                  is inserted in the follwing code:

                  Code:
                  Alert ("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);
                  Many thanks..

                  Originally posted by NinjaTrader_Jesse View Post
                  Hello,

                  To get the instrument name you have two ways, for futures specifically.

                  Code:
                  Instrument.FullName
                  This will give you the entire name or ES 06-15 for example.

                  Or there is

                  Code:
                  Instrument.Name
                  Which only gets the instrument or ES for example.

                  I look forward to being of further assistance.

                  Comment


                    #10
                    Hello,

                    This could go with your string so you would need to use the plus sign to append the additional information.

                    So where you have your string of "Reached threshold"

                    It would instead look like this:

                    Instrument.FullName + " Reached threshold"

                    Please let me know if I may be of additional assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks Jesse for staying with me.

                      The
                      Code:
                      Instrument.FullName
                      works fine and compiles.

                      However,
                      Code:
                      Instrument.Name
                      will not compile. and gives error.

                      I am interested in futures name only not the contract dates.

                      Thanks again.

                      Originally posted by NinjaTrader_Jesse View Post
                      Hello,

                      This could go with your string so you would need to use the plus sign to append the additional information.

                      So where you have your string of "Reached threshold"

                      It would instead look like this:

                      Instrument.FullName + " Reached threshold"

                      Please let me know if I may be of additional assistance.

                      Comment


                        #12
                        Hello,

                        Pardon my mistake,

                        I will update the prior posts with the correct syntax, I had forgot MasterInstrument or:

                        Code:
                        Instrument.MasterInstrument.Name
                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          Thanks Jesse,

                          I think to get just the name of the instrument without the contract date perhaps the following is the proper code, it compiles.

                          Code:
                          Instrument.MaterInstrument.Name
                          .

                          Cheers!

                          Comment


                            #14
                            line alerts

                            how do I set a line alert in NT ?

                            Comment


                              #15
                              Originally posted by laredo787 View Post
                              how do I set a line alert in NT ?
                              With this?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by traderqz, Today, 09:44 AM
                              0 responses
                              0 views
                              0 likes
                              Last Post traderqz  
                              Started by rocketman7, Today, 09:41 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post rocketman7  
                              Started by rocketman7, Today, 02:12 AM
                              7 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by guillembm, Yesterday, 11:25 AM
                              3 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by junkone, 04-21-2024, 07:17 AM
                              10 responses
                              149 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X