Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Higher Timeframe in indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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; }
    I can then use the following syntax to access values, again please keep in mind this is not documented or expected to work correctly. I am unsure of any sync issues that could arise from the use of this code.

    Code:
    protected override void OnBarUpdate()
    {
    Print(Close.GetValueAt(Count - CurrentBar) + " " + MyInput.GetValueAt(Count - CurrentBar));
    }
    Please let us know if this does not resolve your inquiry.

    Comment


      #3
      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
      Click image for larger version  Name:	Screen Shot 2022-06-30 at 7.12.55 AM.png Views:	0 Size:	78.8 KB ID:	1207073Click image for larger version  Name:	Screen Shot 2022-06-30 at 2.14.00 PM.png Views:	0 Size:	925.8 KB ID:	1207092

      Here are my questions?
      1. 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
      2. 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.
      3. 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


        #4
        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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        637 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X