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!
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
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 algospoke, Yesterday, 06:40 PM
|
2 responses
21 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
21 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment