Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add DateTimePicker to properties NT8?

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

    How to add DateTimePicker to properties NT8?

    How to add DateTimePicker to properties NT8?

    I wish to add a DateTimePicker to the properties of a ninjascript so it will appear in the indicator UI (essentially similar to DateTime in properties where I can select a date from the drop-down calendar). However I wish to select a Time only.

    I successfully added "public DateTimePicker" to properties where it then appeared in the UI but it was empty with no information. Not surprising

    So my question is: What to do next?

    I found this on stackoverflow.com:

    Code:
    using  System.Windows.Forms.Control;
    
    timePicker = new DateTimePicker(); 
    timePicker.Format = DateTimePickerFormat.Custom;
    timePicker.CustomFormat = "HH:mm"; // Only use hours and minutes
    timePicker.ShowUpDown = true;
    I just don't know where to place the code.

    Regards,

    Simon.

    #2
    You can use the undocumented TimeEditor

    Code:
    [Gui.PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")]
    public DateTime MyTime {get; set;}
    
    protected override void OnStateChange()
    {
    
    ... rest of code...
    I've submitted your post as a vote to document this property editor.
    MatthewNinjaTrader Product Management

    Comment


      #3
      [Gui.PropertyEditor("NinjaTrader.Gui.Tools.TimeEdit orKey")]
      This is really nice! Thank you for this.

      Is there a list of all of these "tools"? (even if they aren't documented)

      Comment


        #4
        Hello neoikon,

        We would not be able to provide a list of these undocumented tools.

        Any property grid/control in NinjaTrader 8 could potentially be used in NinjaScript, however we cannot guarantee their functionality due to other dependencies.

        Features and controls will be documented when there is further demand. If you see a control that you want to implement in your script, we can provide resources if needed on a case by case basis.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          I understand that there isn't a list of these controls, so I will ask if there is one for an INT parameter that includes a simple up/down arrow controls to it?

          Similar to how the TimeEditorKey includes up/down arrow controls, but for a single INT value.

          I tired IntBuilderEditor, IntBlankEditor, NumericEditor, and DoubleBuilderEditor without luck. Perhaps there isn't one?

          Thanks!
          Last edited by neoikon; 08-10-2016, 10:25 AM.

          Comment


            #6
            Originally posted by neoikon View Post
            I understand that there isn't a list of these controls, so I will ask if there is one for an INT parameter that includes a simple up/down arrow controls to it?

            Similar to how the TimeEditorKey includes up/down arrow controls, but for a single INT value.

            I tired IntBuilderEditor, IntBlankEditor, NumericEditor, and DoubleBuilderEditor without luck. Perhaps there isn't one?

            Thanks!
            Is this for a property grid, such as an indicator or strategy property? Or are you using a custom Add on window?

            If an add-on, you can use the Quantity up/down selector: http://ninjatrader.com/support/helpG...tityupdown.htm

            But for a property grid, there is no concept of a numeric up/down selector that I have seen implemented.
            MatthewNinjaTrader Product Management

            Comment


              #7
              Thank you for the reply. This is for just a simple indicator parameter, that's of integer type.

              Would this be considered a "property grid"?

              Assuming so, what is the proper term for a parameter that is a List of class objects? For example, the fibonacci-based drawing tools have a List<PriceLevel> parameter, that opens a dialog box to add/remove items in this List. Is there a particular name for this parameter type?
              Last edited by neoikon; 08-10-2016, 02:08 PM.

              Comment


                #8
                Originally posted by neoikon View Post
                Thank you for the reply. This is for just a simple indicator parameter, that's of integer type.

                Would this be considered a "property grid"?
                Yes, that would be a property grid implementation. Generally anything you see from Tools-> Options, or right clicking on a window and select "Properties" would be a property grid. These property grids are also used for indicator and strategy properties (parameters).

                Originally posted by neoikon View Post
                Assuming so, what is the proper term for a parameter that is a List of class objects? For example, the fibonacci-based drawing tools have a List<PriceLevel> parameter, that opens a dialog box to add/remove items in this List. Is there a particular name for this parameter type?
                We use a custom collection editor for that specific use case. There is not a generic collections editor available we can provide at this time.
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  Originally posted by NinjaTrader_Matthew View Post
                  We use a custom collection editor for that specific use case. There is not a generic collections editor available we can provide at this time.
                  Okay, thanks. Yes, I've created a few of these "generic collection editors" for custom drawing tools and they are great! I guess what I was looking for was the term "collections editor" when speaking about them in the forums.

                  Comment


                    #10
                    While on the subject of specialty parameters, I know you can use an enum that creates a drop down list in the parameters. Is there a way to have that drop down dynamic at run time? Perhaps a List<string>? Something else? It does not need to be modifiable by the user.

                    I tried a List<string> and added 4 options to it in SetDefaults, but the parameter simply says "4 string(s)". Is there an additional decoration I can add to the parameter to make it treat it as a drop down?

                    (I also tried Dictionary<string,int> with similar results)

                    Any help is greatly appreciated.
                    Last edited by neoikon; 10-03-2016, 10:32 AM.

                    Comment


                      #11
                      Hello neoikon,

                      Using a list to make a drop-down would require a custom TypeConverter modifying the PropertyDescriptorCollection and adding a custom PropertyDescriptor which is not supported by NinjaTrader to do.

                      It has been previously requested that NinjaTrader fully support custom type converters.
                      This request is being tracked with ID# SFT-1558. I will be adding your vote toward this.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by funk10101, Today, 12:02 AM
                      1 response
                      10 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Started by GLFX005, Today, 03:23 AM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by nandhumca, Yesterday, 03:41 PM
                      1 response
                      12 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by The_Sec, Yesterday, 03:37 PM
                      1 response
                      11 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by vecnopus, Today, 06:15 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post vecnopus  
                      Working...
                      X