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 Higher Timeframe in indicator
Collapse
X
-
Adding Higher Timeframe in indicator
I would like to add a higher timeframe input series to an indicator. I am looking of a way to create a property for the series definition, and how to use it to create the input. Is there any example I could see how it's done?
Tags: None
-
Hello Shai Samuel,
Thank you for your post.
The supported and documented way to do this would be to not use a input picker and hard code the series by adding that series: http://ninjatrader.com/support/helpG...=adddataseries.
In theory, you could recreate an input picker using the following syntax. Please note that this does not necessarily apply the series in the same way as the original input picker does so there are unknown consequences by using the following syntax as it is not documented. You would need to test and see if this can or will work for what you want to do.
Code:[Display(Name = "MyInput", Prompt = "Pick MA Series!", Order = 99)] [PropertyEditor("NinjaTrader.Gui.Tools.InputEditor" )] [XmlIgnore] public ISeries<double> MyInput { get; set; }
Code:protected override void OnBarUpdate() { Print(Close.GetValueAt(Count - CurrentBar) + " " + MyInput.GetValueAt(Count - CurrentBar)); }
Kate W.NinjaTrader Customer Service
- Likes 1
-
Hello Kate, thank you for the quick reply. When I open in the Indicator UI the "NinjaTrader.Gui.Tools.InputEditor" field, I get a dialog which looks like it was not setup properly (see the image on the left):- The Available list only the default instruments
- The folder that shows up is "Indicators", and not BarTypes as I would expect
- The only change you could do to an exiting series, is to change the price type
Here are my questions?- Is something missing in my system? I did expect something like the "Data Series" (the image on the right), that is available in Indicators, maybe without the option to choose the instrument
- Clearly I am looking for a way to offer the use to define the other timeframe period. So alternatively, if I use BarsTypePeriod as a property, its doesn't include custom barTypes.
- I also saw a way to get all types using NinjaTrader.Core.Globals.AssemblyRegistry.GetDeriv edTypes(typeof(BarsType)), but I am not clear how I can translate this into a dropDown menu that can be used as property.
Code:Type[] types = NinjaTrader.Core.Globals.AssemblyRegistry.GetDerivedTypes(typeof(BarsType)); for (int i = 0; i < types.Length; i++) { Type type = types[i]; if (type == null || type.FullName.IsNullOrEmpty()) continue; var type2 = NinjaTrader.Core.Globals.AssemblyRegistry.GetType( type.FullName); if (type2 == null) continue; BarsType bar = Activator.CreateInstance(type2) as BarsType; if (bar != null) { bar.SetState(State.SetDefaults); int id = (int)bar.BarsPeriod.BarsPeriodType; Print(string.Format("{0} - {1}", bar.Name, id,id)); bar.SetState(State.Terminated); } }
Last edited by Shai Samuel; 06-30-2022, 06:10 AM.
Comment
-
Hello Shai Samuel,
Thank you for your reply.
As I mentioned previously, the above code is undocumented, which means it's not supported. The supported and documented way to add a data series would be to hard code it using AddDataSeries. Adding data series dynamically is unsupported and may result in errors.
As far as NinjaTrader.Core.Globals.AssemblyRegistry.GetDeriv edTypes(typeof(BarsType)), this would be undocumented and unsupported.
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
1 view
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
3 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
44 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
5 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
9 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
Comment