The indicator only sets -1 or 1, yet I see results like 1.23 or .87, different parameters than what my indicator is supposed to produce. Any ideas as to how to eliminate this problem?
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
Wrong values when indicator accessed from another indicator or strategy
Collapse
X
-
Wrong values when indicator accessed from another indicator or strategy
I am trying to modify an indicator so that I can use its values in another indicator or strategy. I am noticing that when I use the indicator on the chart by itself, the values are correct. However when I access the same plot series from another indicator, there are ghost values present that do not come from the indicator.
The indicator only sets -1 or 1, yet I see results like 1.23 or .87, different parameters than what my indicator is supposed to produce. Any ideas as to how to eliminate this problem?Tags: None
-
Hello richa61416,
Instead of using an indicator added directly to the chart, use the Add() call in the strategy to add the indicator using the same overload parameters being called in the script.
If the data is the same, the indicator is the same, and the parameters are the same, the plot values will be the same.Chelsea B.NinjaTrader Customer Service
-
Can you post a link showing me an example of adding the indicator using the Add method, and then referencing that added indicator. I usually call the indicator when needed, but I assume that probably creates a new instance hence giving me junk data.
thanks
Comment
-
Hi richa61416,
There are two ways to add the indicator.
The help guide shows calling the indicator directly:
Add(SMA(20));
Add() - http://ninjatrader.com/support/helpGuides/nt7/add2.htm
But you can also save the indicator to a variable to make this easier to call. (Especially good when an indicator has a lot of parameters)
For example:
In #region Variables:
private SMA mySMA;
In Initialize():
mySMA = SMA(14);
Add(mySMA);
In OnBarUpdate():
Print(mySMA[0]);Chelsea B.NinjaTrader Customer Service
Comment
-
Comment
-
Hello richa61416,
The indicator being called has two plots?
What should I be focusing on in this screenshot?
I see that background color isn't pink in some places on the lower chart.
The color seems to be different on the dots of one plot.
There is a blue line on the chart above.
However, you have multiple indicators being added to the panel on the top. I wouldn't be able to tell what is what. Please remove all indicators except for the one being called by the strategy.Chelsea B.NinjaTrader Customer Service
Comment
-
Yea. They are all part of the same indicator. What is missing is the PINK signal. If you notice the top one that is added using add indicator contains the pink. The lower one without the pink is the one added using the strategy. The inputs are visible and is the same. The Pink and blue plots is the same plot series, however the negative sign one if not showing. Even tried making it positive by still nothing.
Comment
-
Hello richa61416,
May I test the script on my end to see if I get the same results?
To export a NinjaTrader 7 NinjaScript do the following:- Click File -> Utilities -> Export NinjaScript
- Enter a unique name for the file in the value for 'File name:'
- Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
- Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message
By default your exported file will be in the following location:- (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript\<export_file_name.z ip>
Below is a link to the help guide on Exporting NinjaScripts.
http://www.ninjatrader.com/support/h...nt7/export.htm
Once exported, please attach the export to your next post.Chelsea B.NinjaTrader Customer Service
Comment
-
Sure. Here it is. From the screen shot please note that I am using FisherTransform to feed the input series.Attached Files
Comment
-
Hello richa61416,
Your export did not contain a strategy to test, it only contained the indicator.
As a convenience to you I have created a strategy on your behalf to test adding the indicator to the chart with the Add() call and then comparing the values from the output of the strategy to the values shown on the chart.
Below is a link to a video I created to show that while testing this, all values on the chart matched the values printed by the strategy.
http://screencast.com/t/vl2TSd2E
And attached is an export of the script I made to test this indicator. (Besure to add this to a blank chart that does not have any indicators on it.)Attached FilesChelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by egordleo, Today, 05:50 AM
|
0 responses
4 views
0 likes
|
Last Post
by egordleo
Today, 05:50 AM
|
||
Started by kevinenergy, 02-17-2023, 12:42 PM
|
118 responses
2,778 views
1 like
|
Last Post
by kevinenergy
Today, 05:41 AM
|
||
Started by briansaul, Today, 05:31 AM
|
0 responses
9 views
0 likes
|
Last Post
by briansaul
Today, 05:31 AM
|
||
Started by fwendolynlpxz, Today, 05:19 AM
|
0 responses
4 views
0 likes
|
Last Post Today, 05:19 AM | ||
Started by traderqz, Yesterday, 12:06 AM
|
11 responses
28 views
0 likes
|
Last Post Today, 05:11 AM |
Comment