Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Properties for second data set for indicator

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

    Properties for second data set for indicator

    Hi,
    I want to use an alternative timeframe and/or bartype for an existing indicator. Are there some standard properties that I can somehow add to select the data from the indicator properties? I know how to use the datastream inside the indicator.I have seen this in other indicators..
    Thank-you,
    iq

    #2
    Hello iq200,

    Thank you for your post.

    It is possible to set up a BarsType enum and a period enum property and pass these into AddDataSeries(). It is OK to do this if you add the strategy a chart, but it might not work if you try to optimize the strategy through the strategy analyzer.

    The Spread indicator takes a string from the user to add the desired data series:
    Plots the Spread of two instruments The first instrument is the primary chart data series. The secondary instrument is specified by the parameter "Symbol2". The Parameters "Qty1" and "Qty2" are multipliers which are applied to each instrument's price before adding the two; default values are "Qty1=1" and "Qty2=‐1" which will simply plot the difference between […]


    Take this same concept and add a BarsType selector and a period int.

    This is how you will add a bars type selector:

    Code:
    [NinjaScriptProperty]
    [TypeConverter(typeof(NinjaTrader.Gui.Tools.BarsPeriodTypeSelector))]
    [Display(Name="Select BarsPeriodType", GroupName = "Parameters", Order = 0)]
    public BarsPeriodType BarsPeriodTypeInput
    { get; set; }
    Please let me know if I can assist further.

    Comment


      #3
      Hi Chris,
      Thank-you so much - that sounds like what I need.
      Regards,
      iq

      Comment


        #4
        Originally posted by NinjaTrader_ChrisL View Post
        Hello iq200,

        Thank you for your post.

        It is possible to set up a BarsType enum and a period enum property and pass these into AddDataSeries(). It is OK to do this if you add the strategy a chart, but it might not work if you try to optimize the strategy through the strategy analyzer.

        The Spread indicator takes a string from the user to add the desired data series:
        Plots the Spread of two instruments The first instrument is the primary chart data series. The secondary instrument is specified by the parameter "Symbol2". The Parameters "Qty1" and "Qty2" are multipliers which are applied to each instrument's price before adding the two; default values are "Qty1=1" and "Qty2=‐1" which will simply plot the difference between […]


        Take this same concept and add a BarsType selector and a period int.

        This is how you will add a bars type selector:

        Code:
        [NinjaScriptProperty]
        [TypeConverter(typeof(NinjaTrader.Gui.Tools.BarsPeriodTypeSelector))]
        [Display(Name="Select BarsPeriodType", GroupName = "Parameters", Order = 0)]
        public BarsPeriodType BarsPeriodTypeInput
        { get; set; }
        Please let me know if I can assist further.
        Actually Chris, this is not what I was looking for. The spread example seems to expect the secondary data to already be loaded and then one selects it.
        I want to be able to select the data a bit like in the Data Series for where I type the symbol and period and to be able to select the bartype from a combo.
        I have more sophisticated ways of taking in the information for a secondary data series in an indicator (no code available).

        Comment


          #5
          Hello iq,

          Thanks for your reply.

          I've attached a sample indicator that allows you to pick a secondary data series including the instrument, BarType, and period. Is this what you are looking for? Place the attached file within Documents\NinjaTrader 8\bin\Custom\Indicators then it can be edited and tested.

          I look forward to hearing of your results.
          Attached Files

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          628 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          359 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          562 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X