![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Oct 2010
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
|
When creating a new indicator with Tools-->New NinjaScript-->Indicator,
one can use the value of Input[barsAgo] since this allows flexibility for what the indicator is calculated based off of, because users have the option to select a price type (High, Open, Close etc...) from the Indicator Dialog window. This is nice and working correctly. However, if I write e.g. High[barsAgo] in the script, although this also works correctly, my problem is that the user still could select a price type (High, Open, Close etc...) from the Indicator Dialog window and it doesn’t seem that the logic is hard coded in the script for something other than Input[barsAgo] and changing the setting has no effect. My suggestion: If other than Input[barsAgo] is used then darken (make it impossible to change) the price type in the Indicator Dialog window (Data \ Input series). |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Arpad,
If you code to not use Input[] you can use PriceTypeSupported = false in the Initialize() method to remove the options.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2010
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
|
I’ve just tried it.
I used the code from the Help \ NinjaScript \ Tutorials \ Indicators \ Intermediate – Your own SMA and inserted the code you suggested, There is no difference. The setting still available, can be altered, and the plotting of the graph is changing depending on what I price type I set in the dialog window. The code look like this: protectedoverridevoid Initialize() { PriceTypeSupported = false; Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0")); Overlay = true; } ///<summary> /// Called on each bar update event (incoming tick) ///</summary> protectedoverridevoid OnBarUpdate() { if (CurrentBar < Period) return; double sum = 0; for (int barsAgo = 0; barsAgo < Period; barsAgo++) { sum = sum + Input[barsAgo]; } Plot0.Set(sum / Period); } Step by step what I did: 1) Typing in the above code 2) Press F5 to compile 3) Open a new data series 4) Apply the MySMA indicator 5) Play with the price type settings – the plotting changes. No good! |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Arpad, are you working with NT 6.5 or 7 beta?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2010
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
|
7.0.0.23 latest
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
In that case, this is expected. NT7 selection really lets you choose whatever you want to run the indicator on as the input series. There is no way to limit the selector as it is made for greater flexibility than 6.5 in providing customization for the user.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Oct 2010
Posts: 60
Thanks: 0
Thanked 0 times in 0 posts
|
You don’t understand me.
Let’s try again. The problem: Even if you write other than Input[barsAgo] in the indicator script, you can choose whatever you want (High, Low, Median etc.) in the indicator dialog. And even if you change the setting in the indicator dialog, it is not reflected in the plotting – the graph does not change. Why is this problem? If one writes an indicator script and at a later time use it, maybe he decides to change the price type in the indicator dialog. This is possible (unfortunately) so he changes it. And the change is not reflected on the plot. (Since e.g. Low[barsAgo] is written in the script.) There is some misleading here. If one cannot change the price type from the indicator dialog (this is OK, since the script define an exact type), NinjaTrader should not let the user think that he can change the type from the indicator properties window. |
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
If you write anything other than Input it will use exactly what you typed in code wise, completely disregarding what you selected in the UI dialogue window. The UI window at that point in time is only relevant for the instrument you choose to run the indicator on. Selecting high, low, etc. from the UI makes no difference to your code if your code uses something other than Input[].
This is correct behavior. If code explicitly statesLow[], changing UI options will not run off anything but the Low. There is no way the UI option would be reflected anywhere except when the code uses Input[]. There is no way to limit the selector window as NT7 selector is simply different than 6.5s. Furthermore, it is not misleading to let people choose High or Low series for the input even when it does nothing to the values evaluated out by the indicator. For example, even if we somehow could do your suggestion and limit the selector window by graying out all the options, this would mean the option selected is the default Close series. When this series is selected no one is expecting explicit code that says High[] or Low[] to all of a sudden be replaced by Close[]. The same concept carries over to if the series selected was the High series. You would not expect the explicit code of Low[] to all of a sudden be evaluated as if it were High[] because that was the series selected. Choosing a price type is only relevant and only impacts Input[]. Code that does not use Input[] simply is not impacted.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Price Change Bar Type | monpere | Charting | 4 | 10-14-2012 01:48 PM |
| New Input Price Type Please... | RJay | Suggestions And Feedback | 9 | 09-11-2009 12:12 PM |
| FisherTransform not responsive to change in price type - need help fixing | Little Prof | Indicator Development | 2 | 05-14-2009 01:16 PM |
| Make custom candles OR change price data candles are drawn from? | PipSqueak | Indicator Development | 1 | 11-19-2008 07:34 AM |
| How to make the price ladder stop moving when no change in price | Trinity | Miscellaneous Support | 1 | 08-02-2006 07:41 PM |