Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding and Alert to the CCI Indicator
Collapse
X
-
Hello danp502,
You can modify the CCI indicator by making a copy of it with a different name and then add alerts.
Please use the steps I have provided below to create a copy of an indicator:- In the Control Center select Tools > Edit NinjaScript > Indicator...
- Select the indicator to copy > Click Ok
- Right-click within the code window > select Save As
- Give the indicator a unique name > Click OK
Below is a link to Alert() in the Help Guide.
http://www.ninjatrader.com/support/h.../nt7/alert.htm
Also, because this was a simple change, I have modified the indicator for you so that you have a working example and you can use this to modify other scripts or create your own.Attached FilesChelsea B.NinjaTrader Customer Service
-
Hi,
Can someone add an alert option to this indicator for me, Please.
As Chelsea said, I guess a parameter is the answer, as I guess that means it shows up when the indicator is added to a chart, and one can change the sound alert?
Thank you,
JoeAttached Files
Comment
-
Hi westcoastjoe,
Using the example in post #4 you should be able to add a string input parameter that allows you to type a filename and use this as the sound file located in C:\Program Files (x86)\NinjaTrader 7\sounds\.
In this example we create a string to store the filename with a default value:
private string soundFile = "Alert1.wav";
Create a public input the user can type into:
[Description("Name of file for alert sound located in C:\\Program Files (x86)\\NinjaTrader 7\\sounds\\")]
[GridCategory("Parameters")]
public string SoundFile
{
get { return soundFile; }
set { soundFile = value; }
}
And use this string for the soundLocation override in the Alert call:
Alert("CCIcross", NinjaTrader.Cbi.Priority.Low, "CCI Crossed above 100", soundFile, 1, Color.White, Color.Black);
Alert(string id, Priority priority, string message, string soundLocation, int rearmSeconds, Color backColor, Color foreColor)
If you want to add an option to turn the alerts on or off, you can use a bool for this. Bool is short for boolean which holds a true or false value.
For example:
Create the bool:
private bool useAlerts = true;
Create a public input:
[Description("Use Alerts")]
[GridCategory("Parameters")]
public bool UseAlerts
{
get { return useAlerts; }
set { useAlerts = value; }
}
In your logic where you want to add the alert use:
if (/* logic to trigger alert && */ useAlerts == true)
{
Alert("myAlert", NinjaTrader.Cbi.Priority.Low, "This is my custom alert", soundFile, 1, Color.White, Color.Black);
}
Below is a link to the help guide on Alert().
http://www.ninjatrader.com/support/h.../nt7/alert.htmChelsea B.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
579 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment