Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
adding moving averages to indicators
Collapse
X
-
adding moving averages to indicators
is there a simple way to add an ema or sma to an indicator. initially when i plotted a rsi to a price structure, the rsi and the avg plotted with it in the data series would both reflect on the chart, for some reason, the avg has disappeared leaving me with just the rsi. I would like it back, however would actually like to learn how to plot my own. I thought it to be easy as adding an indicator to my data series and selecting the same panel as my rsi, but the ema/sma appears flat, merely a horizontal line. I dont even know what data it would address if it were to succeed. Would it reflect the price action or the indicator in the panel it is assigned. Anyways, some guidance would be awesome.
Tags: None
-
You can view the Ninjascript for all the supplied indicators using NT text editor ( Tools - Edit Ninjascript - Indicator).
If you look at the Ninjascript for RSI() it will show how a Plot Class is initialized using the Add() method. All added plot values are then set using the Values[int index], provided the get/set properties are defined in the Properties section of the code.
Code:Add(new Plot(Color.Green, "RSI")); Add(new Plot(Color.Orange, "Avg")); 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 [Browsable(false)] [XmlIgnore()] public DataSeries Avg { get { return Values[1]; } } [Browsable(false)] [XmlIgnore()] public DataSeries Default { get { return Values[0]; } }
-
Hello,
Borland's instructions on how to look at the code for system indicators code is correct and great advice. We recommend to reivew their code and our reference samples on the forum to help with learning and as great tools.
If you are wanting to add an indicator to a strategy you can do so using the Add()-Indicator method which you can find more information on in our help guide at the following link: http://ninjatrader.com/support/helpGuides/nt7/add2.htm
From your inquiry though it sounds like you may have some idea how to do this though and the code is not giving you the expected results. We would be more than happy to take a look at the code if you want to provide a snippet of how you are adding the indicator.Cody B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
569 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 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
548 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