Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
RSI Alert
Collapse
X
-
RSI Alert
Hi, I just want a sound alert once the lower or upper limits have been crossed. LineAlert would do the job, as I could just draw the line manually, unfortunately, it seems to only work on price bars, and not the RSI upper and lower lines.
Thanks.Tags: None
-
Hello bougie,
I'm not aware of an existing indicator that does this, however it would be possible with custom programming.
NinjaTrader is based on the modern C# programming language which allows advanced charting that is extensible in that you can create custom indicators using NinjaScript.
* Click here for information on programming in NinjaScript
You would want to use the Alert() method based upon the condition that you would like.
http://www.ninjatrader.com/support/h...html?alert.htm
For Example:
Let us know if we can be of further assistance.Code:if(CrossAbove(High[0], RSI(20, 3),1) || CrossBelow(Low[0], RSI(20, 3),1)) Alert("myAlert", NinjaTrader.Cbi.Priority.High, "RSI Alert", "Alert1.wav", 10, Color.Black, Color.Yellow);JCNinjaTrader Customer Service
-
Hello bougie,
Thank you for your response.
You would not paste this into the RSI but would follow the instructions below to create a new indicator with the code that JC provided.- Go to Tools > New NinjaScript > Indicator
- Next
- Name the indicator and select Generate
- Then paste the code JC created into the OnBarUpdate() method
- Then press F5 compile
Once complete you code should look like the following:
We have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.Code:#region Variables #endregion /// <summary> /// This method is used to configure the indicator and is called once before any bar data is loaded. /// </summary> protected override void Initialize() { Overlay = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if(CrossAbove(High[0], RSI(20, 3),1) || CrossBelow(Low[0], RSI(20, 3),1)) Alert("myAlert", NinjaTrader.Cbi.Priority.High, "RSI Alert", "Alert1.wav", 10, Color.Black, Color.Yellow); } #region Properties #endregion
A link to our Help Guide can be found below: http://www.ninjatrader.com/support/h...stribution.htm
I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: http://www.ninjatrader.com/support/h..._resources.htm
We also have some Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
Click here to see our NinjaScript Reference Samples
Click here to see our NinjaScript Tips
If you have limited time or programming capabilities, you can discuss your requirements with any of our certified NinjaScript consultants.
Click here for a list of certified NinjaScript Consultants
Please let me know if I may be of further assistance.
Comment
-
Try opening the @RSI.cs file, deleting everything in it (so it's completely blank), then paste the below code into it:
That was taken directly from my stock @RSI.cs file.PHP Code:// // Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>. // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release. // #region Using declarations using System; using System.ComponentModel; using System.Drawing; using System.Xml.Serialization; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; #endregion // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100. /// </summary> [Description("The RSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.")] public class RSI : Indicator { #region Variables private DataSeries avgUp; private DataSeries avgDown; private DataSeries down; private int period = 14; private int smooth = 3; private DataSeries up; #endregion /// <summary> /// This method is used to configure the indicator and is called once before any bar data is loaded. /// </summary> protected override void Initialize() { Add(new Plot(Color.Green, "RSI")); Add(new Plot(Color.Orange, "Avg")); Add(new Line(System.Drawing.Color.DarkViolet, 30, "Lower")); Add(new Line(System.Drawing.Color.YellowGreen, 70, "Upper")); avgUp = new DataSeries(this); avgDown = new DataSeries(this); down = new DataSeries(this); up = new DataSeries(this); } /// <summary> /// Calculates the indicator value(s) at the current index. /// </summary> protected override void OnBarUpdate() { if (CurrentBar == 0) { down.Set(0); up.Set(0); if (Period < 3) Avg.Set(50); return; } down.Set(Math.Max(Input[1] - Input[0], 0)); up.Set(Math.Max(Input[0] - Input[1], 0)); if ((CurrentBar + 1) < Period) { if ((CurrentBar + 1) == (Period - 1)) Avg.Set(50); return; } if ((CurrentBar + 1) == Period) { // First averages avgDown.Set(SMA(down, Period)[0]); avgUp.Set(SMA(up, Period)[0]); } else { // Rest of averages are smoothed avgDown.Set((avgDown[1] * (Period - 1) + down[0]) / Period); avgUp.Set((avgUp[1] * (Period - 1) + up[0]) / Period); } double rsi = avgDown[0] == 0 ? 100 : 100 - 100 / (1 + avgUp[0] / avgDown[0]); double rsiAvg = (2.0 / (1 + Smooth)) * rsi + (1 - (2.0 / (1 + Smooth))) * Avg[1]; Avg.Set(rsiAvg); Value.Set(rsi); } #region Properties /// <summary> /// </summary> [Browsable(false)] [XmlIgnore()] public DataSeries Avg { get { return Values[1]; } } /// <summary> /// </summary> [Browsable(false)] [XmlIgnore()] public DataSeries Default { get { return Values[0]; } } /// <summary> /// </summary> [Description("Numbers of bars used for calculations")] [GridCategory("Parameters")] public int Period { get { return period; } set { period = Math.Max(1, value); } } /// <summary> /// </summary> [Description("Number of bars for smoothing")] [GridCategory("Parameters")] public int Smooth { get { return smooth; } set { smooth = Math.Max(1, value); } } #endregion } }
Comment
-
That shows errors in the shipping NT system indicator. It is hard to see how you could have such an error unless you edited the file outside of the NT editor, as the NT editor would not save any changes to NT system files. As it is hard to know what else may now be corrupted, you would be best off reinstalling NT, then following the instructions that were so clearly written by NinjaTrader_PatrickH.Originally posted by bougie View PostI've tried pasting it, getting many errors, maybe not pasting in right section of code?
[ATTACH]23554[/ATTACH]
Comment
-
Hello boldhead,
Welcome to the NinjaTrader support forums.
Assuming that you are not doing the same steps which the original poster had you should be able to just copy the syntax from post #2 into a new indicator or strategy to make an alert from the RSI. The other content in this thread is related to the users specific situation and will not likely apply toward your situation.
You can learn more about this syntax from the help guide:
I look forward to being of further assistance.
Comment
-
Hello boldhead,
The information in this post is for NinjaScript, so this assumes that you are developing a strategy or indicator already. Once you have created a strategy or indicator, you could utilize the syntax from post #2 to form an alert. The syntax is complete in that post, you would just need to make your script look the same to start working with alerts.
I look forward to being of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
563 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
329 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
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
548 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment