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

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 xiinteractive, 04-09-2024, 08:08 AM
      2 responses
      10 views
      0 likes
      Last Post xiinteractive  
      Started by Irukandji, Today, 09:34 AM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by RubenCazorla, Today, 09:07 AM
      1 response
      5 views
      0 likes
      Last Post RubenCazorla  
      Started by TraderBCL, Today, 04:38 AM
      3 responses
      25 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by WeyldFalcon, 08-07-2020, 06:13 AM
      11 responses
      1,423 views
      0 likes
      Last Post jculp
      by jculp
       
      Working...
      X