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

Sample indicator Script implement Text to Sound Alerts

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

    Sample indicator Script implement Text to Sound Alerts

    Today, 03:49 PM

    Dear Support,

    Requesting @NinjaTrader to post a simple sample indicator showing how to implement text-to-speech in NT8 indicators. This is a badly needed sample for customizing sound alerts.

    I can do that using the Net 3.0 System.Speech.dll for NT7. However, this .dll does not work for NT8. Any reference assembly for Speech that would work for NT8?

    Many thanks.

    Tags: None

    #2
    Hello aligator,

    Thanks for your post.

    We've already provided this, here is a direct link to the ecosystem download: https://ninjatraderecosystem.com/use...ad/pricevoice/

    Please note: The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello aligator,

      Thanks for your post.

      We've already provided this, here is a direct link to the ecosystem download: https://ninjatraderecosystem.com/use...ad/pricevoice/

      Please note: The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
      Thank you Paul,

      Excellent! For the sake of coding simple sound alerts, I have in the past used the free ATT Labs Text-To-Speech for creating custom .wav sound files, However, the ATT Labs is no longer available and the free alternatives such as Text2Speech.org have limited and poor voice. Question: Is there a recommended site for text-to-speech that NT uses to generate default sound files (or any other options).

      Thanks.

      Comment


        #4
        Hello Alligator,

        Thanks for your reply,

        We do not have a recommended site for sound generation.

        In a quick search on line I did find this one: https://www.text2speech.org/
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_PaulH Looked though posts about TTS and have the PriceVoice indicator for which I am grateful.
          Cannot figure out the syntax to speak the chart information for Master Instrument (Instrument.MasterInstrument.Name) and chart timeframe so the speech would start by acknowledging which instrument and chart timeframe generating the alert.

          May I reqyest a sample adding it to something like this: Say ("last closed bar was a Doeji bar"); i.i... Say Instrument.MasterInstrument.Name ("last closed bar was a Doeji bar");

          I am not sure how to find the chart timeframe so it would be even better if it said: Say Instrument.MasterInstrument.Name Chat Timeframe ("last closed bar was a Doeji bar");

          Thank you for you assistance - I hope.

          Comment


            #6
            Hello JMont1,

            Thanks for your post.

            The indicator is provided as open-source and you are welcome to copy and modify as you wish.

            Using the name as found in MasterInstrument likely would not result in a comprehensible voice/sound. If you look at the code you will see what I had to do to get the voice to sound out as it does. For example, to say E-M-A I had to provide it with "EE M A". For a Doji bar I had to make it Doeji to sound right. I could not imagine what NQ or YM would sound like without additional text processing of at least adding a space between letters.

            I think the chart time frame would work because it is a number. You can pull the time frame for standard bars with BarsPeriod.Value and the bar type with BarsPeriod.BarsPeriodType.

            I know that you are not a coder per se but there are really only a few lines in the example that are needed to employ a speech voice. Specifically Lines 22, 36, 57, 83, and 160-165. Where 160 is the method "Say". In OBU you will see wherever the voice is used is Say("speak these words"); that's really all there is.


            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_PaulH View Post
              Hello JMont1,

              Thanks for your post.

              The indicator is provided as open-source and you are welcome to copy and modify as you wish.

              Using the name as found in MasterInstrument likely would not result in a comprehensible voice/sound. If you look at the code you will see what I had to do to get the voice to sound out as it does. For example, to say E-M-A I had to provide it with "EE M A". For a Doji bar I had to make it Doeji to sound right. I could not imagine what NQ or YM would sound like without additional text processing of at least adding a space between letters.

              I think the chart time frame would work because it is a number. You can pull the time frame for standard bars with BarsPeriod.Value and the bar type with BarsPeriod.BarsPeriodType.

              I know that you are not a coder per se but there are really only a few lines in the example that are needed to employ a speech voice. Specifically Lines 22, 36, 57, 83, and 160-165. Where 160 is the method "Say". In OBU you will see wherever the voice is used is Say("speak these words"); that's really all there is.

              I'm getting closer but have one hiccup.
              I can get it to say the Name and the period value but bar type fails. Changing line 103 to:
              Say ("new Bar on " +Instrument.FullName+ +BarsPeriod.Value+ " chart");
              But when I add +BarsPeriod.BarsPeriodType+ it fails.

              Any ideas for getting the bar type another way?

              Comment


                #8
                Hello JMont1,

                Thanks for your reply.

                "But when I add +BarsPeriod.BarsPeriodType+ it fails." I don't know what that means. Does it fail to compile or fail to announce? Do you see an error in the "Log" tab of the NinjaTrader control center?

                On my end it works fine with second, minute, Range, Renko bars tested. Heiken-Ashi is announced although it sounds funny. What barsType are you testing on?

                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_PaulH View Post
                  Hello JMont1,

                  Thanks for your reply.

                  "But when I add +BarsPeriod.BarsPeriodType+ it fails." I don't know what that means. Does it fail to compile or fail to announce? Do you see an error in the "Log" tab of the NinjaTrader control center?

                  On my end it works fine with second, minute, Range, Renko bars tested. Heiken-Ashi is announced although it sounds funny. What barsType are you testing on?
                  Thanks for the help. Got it working sort of too well. On renko and unirenko charts during a fast moving market it will not shut up. Any suggestions on how to perform something similar to the "Rearm" in the alerts code?

                  Comment


                    #10
                    Hello JMont1,

                    Thanks for your reply.

                    Having the voice announce each bar can get annoying.

                    You might consider just having it announce when there is a reversal bar.

                    if (Close[0] >Open[0] && Close[1] < Open[1])
                    {
                    Say ("Direction change, reversal bar Up");
                    }

                    You could also compare the close time of the current bar to the previous bar and if it is less than X seconds to then not announce, or reverse that and only announce when greater than x seconds or minutes. That starts to get into questionable value though. I think announcing reversal bars in Unirenko is a good use.


                    Paul H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    18 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post Javierw.ok  
                    Started by timmbbo, Today, 08:59 AM
                    2 responses
                    10 views
                    0 likes
                    Last Post bltdavid  
                    Started by alifarahani, Today, 09:40 AM
                    6 responses
                    41 views
                    0 likes
                    Last Post alifarahani  
                    Working...
                    X