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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      174 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      329 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      252 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      355 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      182 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X