Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using PeriodType.ID in user parameters

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

    Using PeriodType.ID in user parameters

    How to give the user an option to select which Bars objects to Add() to the chart?

    Something like this:

    private BarsPeriod.Id bars1period = PeriodType.Day;
    [GridCategory("Parameters")] [Gui.Design.DisplayNameAttribute("Bars[1] Period")]
    public BarsPeriod.Id Bars1period { get { return bars1period; } set { bars1period = value; } }

    private BarsPeriod.Value bars1value = 1;
    [GridCategory("Parameters")] [Gui.Design.DisplayNameAttribute("Bars[1] Value")]
    public BarsPeriod.Value Bars1value { get { return bars1value; } set { bars1value = value; } }

    So later this will be possible:

    Initialize()
    {
    Add(bars1period, bars1value);
    }

    #2
    Just define the variables :
    #region Variables
    private int OT_XMA_Period = 50 ;
    private int OT_TimeUnit = 5 ;
    private PeriodType x= PeriodType.Minute;
    #endregion
    ...then add the new timeframe on initialize;
    protected override void Initialize()
    {
    Add( x ,OT_TimeUnit);
    .....
    ...

    and let user change those settings :
    #region Properties
    [Description("")] [GridCategory("Parameters")]
    public PeriodType OT_Time_Type { get { return x; } set { x = value; } }

    [Description("")] [GridCategory("Parameters")]
    public int OT_Time_Unit { get { return OT_TimeUnit; } set { OT_TimeUnit = value; } }

    Regards,
    Pablo
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    Comment


      #3
      I didn't know the correct classes. That's perfect, thanks.

      Comment


        #4
        Can the programmer set the default PeriodType as well as the PeriodValue? If so, how? and I assume you do that in the Initialize()...

        Thanks - David

        Comment


          #5
          Yes,

          the programmer set the default value on the variables definition

          private PeriodType x= PeriodType.Minute;

          then the user can change it on #region Properties
          pmaglio
          NinjaTrader Ecosystem Vendor - The Indicator Store

          Comment


            #6
            if I'm not mistaken that will set a local variable to that type. I'm wondering how to set the strategy to a specific PeriodType so when I configure the strategy I don't have to worry about that ,,,,

            Comment


              #7
              Originally posted by dadof3and3 View Post
              if I'm not mistaken that will set a local variable to that type. I'm wondering how to set the strategy to a specific PeriodType so when I configure the strategy I don't have to worry about that ,,,,
              You declare private properties in the backing store, then expose them publicly using a getter and a setter.

              Comment


                #8
                Originally posted by koganam View Post
                You declare private properties in the backing store, then expose them publicly using a getter and a setter.
                Yes, but does that change the properties of the NT strategy... I'll do some testing.

                Comment


                  #9
                  Originally posted by dadof3and3 View Post
                  Yes, but does that change the properties of the NT strategy... I'll do some testing.
                  If you expose it as public, PeriodType is an enum. It should show up as a drop-down list in the config GUI.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  566 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  330 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  547 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  548 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X