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?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding Text Strings to Sound Alerts
Collapse
X
-
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?Tags: None
-
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
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
-
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
-
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
-
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
-
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
-
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 PostHello,
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
-
Hello,
To get the instrument name you have two ways, for futures specifically.
Code:Instrument.FullName
Or there is
Code:Instrument.MasterInstrument.Name
I look forward to being of further assistance.Last edited by NinjaTrader_Jesse; 03-27-2015, 11:01 AM.JesseNinjaTrader Customer Service
Comment
-
Thanks a bunch Jesse:
Would you please show how and whereCode:Instrument.Name
Code:Alert ("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);
Originally posted by NinjaTrader_Jesse View PostHello,
To get the instrument name you have two ways, for futures specifically.
Code:Instrument.FullName
Or there is
Code:Instrument.Name
I look forward to being of further assistance.
Comment
-
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
-
Thanks Jesse for staying with me.
TheCode:Instrument.FullName
However,Code:Instrument.Name
I am interested in futures name only not the contract dates.
Thanks again.
Originally posted by NinjaTrader_Jesse View PostHello,
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
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DeskTroll, Today, 12:09 PM
|
3 responses
22 views
0 likes
|
Last Post Today, 03:52 PM | ||
Started by Pabulon, 12-02-2024, 03:42 PM
|
14 responses
90 views
0 likes
|
Last Post
by Pabulon
Today, 03:36 PM
|
||
Started by tfa2806trader, Today, 12:04 PM
|
10 responses
25 views
0 likes
|
Last Post Today, 03:32 PM | ||
Started by trdninstyle, 11-26-2024, 12:23 PM
|
62 responses
186 views
0 likes
|
Last Post
by trdninstyle
Today, 03:24 PM
|
||
Started by lorien, 08-08-2021, 07:33 AM
|
12 responses
721 views
0 likes
|
Last Post
by AndyM871
Today, 02:45 PM
|
Comment