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!
See more
See less

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.
    Chris L.NinjaTrader Customer Service

    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
          Chris L.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by terofs, Yesterday, 04:18 PM
          1 response
          21 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          7 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Started by RookieTrader, Today, 09:37 AM
          2 responses
          13 views
          0 likes
          Last Post RookieTrader  
          Started by alifarahani, Today, 09:40 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X