Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I gain access to the properties of a control in a strategy propertygrid?

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

    How can I gain access to the properties of a control in a strategy propertygrid?

    Hi, this code displays a DateTimePicker in the property grid of a strategy. By default this DateTimePicker allows a date *only* to be selected, the time returned is 0000hrs when the control is used.

    Code:
    //File Date & Time Stamp
    [Description("Date & Time Stamp For Output Files")]
    [Category("Parameters")]
    public DateTime Time_Stamp
     {
      get { return timeStamp; }
      set { timeStamp = value; }
     }
    Ideally I would like to be able to select the current *date* & *time* to pass to my strategy. Which will likely require access to the properties of this DateTimePicker control.

    How can I access the properties of the propertygrid DateTimePicker so that I could change the Format to 'Time' to allow the time to be selected (with current time displayed by default). Or even better have the DateTimePicker simply return the DateTime value of now from which I can extract *date* & *time*?

    Thanks

    Riskybiz

    #2
    Hi Riskybiz,

    Methods for changing the UI properties for the Strategy Grid is not necessarily supported, however you could access one of the following...

    DateTime.Now
    ToDay(Time[0])
    ToTime(Time[0])

    which returns, respectively...

    4/21/2010 7:05:00 AM
    20100421
    70500
    Last edited by NinjaTrader_Tim; 04-21-2010, 07:04 AM.
    TimNinjaTrader Customer Service

    Comment


      #3
      Does anybody know the syntax to add the DateTimePicker control to the indicator's parameters?
      Like it requires to be added to a form.
      A DateTimePicker control allows users to select a date and time in Windows Forms applications. In this tutorial, we will see how to create a DateTimePicker control at design-time as well as at run-time, set its properties and call its methods.
      Last edited by clocker; 09-28-2012, 11:33 AM.

      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