Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Customizing BarsPeriod property displays

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

    Customizing BarsPeriod property displays

    My goal is to setup my BarsType so that the data series editor has the following look/feel and characteristics as shown in the attached image.
    There should be three properties visible, mapping to the BarsPeriod properties as:

    Click image for larger version

Name:	dataseries.jpg
Views:	109
Size:	52.0 KB
ID:	1081756

    Brick Size ==> Value
    Open Percentage ==> Value2 (Range from 0 to 100)
    Reversal Percentage ==> BaseBarsPeriodValue (Range from 100 to int.MaxValue)

    NT8 provides a SetPropertyName method to change the display name of the properties, which is helpful, but I also need to adjust the display order of the properties and enforce the range limits.

    To achieve this, I wrote the following code in the BarsType:

    Click image for larger version

Name:	statechange.jpg
Views:	86
Size:	339.5 KB
ID:	1081757

    Well, that code's pretty readable, but obviously, it makes use of some extension methods. I've attached the extension methods in a .cs file to this post.

    And ... it works beautifully!!!

    BUT ... there's an issue ... my property descriptor changes "stick" when the user switches the data series to another bars type. For example, if the user tries to switch to Minute bars, the "Brick Size", "Open Percentage", and "Reversal Percentage" properties will still be visible when editing minute bars.

    Obviously, my code has gone a bit "deeper inside" than intended. That seems like an NT8 bug to me, as I would have expected NT8 to properly refresh the property descriptor collection from scratch when the user changed to a different bars type such as minute bars. But I'm not hung up on getting NT8 changed over this, I just want to be able to set the order and min/max range for the properties.

    What is your advise on the matter?




    #2
    I've attached code now so that you can reproduce the issue:

    Step 1: Install the attached bars type .cs file. Open your editor and press F5 to compile it. This bars type code is a copy of minute bars code with modified PropertyDescriptors.

    Step 2. Open a new chart and select the "CustomProperties" bars type as shown:

    Click image for larger version

Name:	step2.jpg
Views:	97
Size:	55.7 KB
ID:	1081760
    Step 3. Hit OK and let the chart load. Then press Ctrl+F to open the data series again, and switch the "Type" to any other type, such as Minute bars.
    The "Value" property will be wrongly named "Brick Size" as shown below.

    Click image for larger version

Name:	step3.jpg
Views:	88
Size:	42.2 KB
ID:	1081761

    Comment


      #3
      Hello bboyle1234,

      Thank you for the post.

      I believe the problem is that there is currently no means to Add new or update or otherwise modify existing properties in the descriptor collection. The BarsTypes are hard coded to have specific properties and cannot be changed in other ways other than renaming or hiding of the existing properties.

      What you are doing is the way you would control a PropertyDescriptor in a normal C# application however from this context the platform is not expecting those type of changes. It only expects that you will be using the two documented methods to modify the BarsType existing properties. Any modifications outside of that will not likely work as expected in this area due to the rigid structure of the BarsType. In this case there is not much I can offer as a solution here as there are no documented/supported/unsupported alternatives that I can provide. I will put in a feature request for allowing the property descriptor collection to be managed by the BarsType directly or to just support standard public properties like an indicator.



      I look forward to being of further assistance.



      JesseNinjaTrader Customer Service

      Comment


        #4
        I'm aware of "SetPropertyName" ... what is the other documented method?

        My feature request would be to provide "SetOrder" and "SetRange" methods similar to "SetPropertyName".

        Comment


          #5
          Hello bboyle1234,

          Thank you for your reply.

          All that would be supported is SetPropertyName and Properties.Remove to remove and modify properties of BarsTypes and ChartStyles:

          https://ninjatrader.com/support/help...pertyname2.htm
          https://ninjatrader.com/support/help...opertyname.htm

          I have created a feature request for you to provide SetOrder and SetRange methods. This request is being tracked under the number SFT-4507.

          As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

          Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by tgn55, Today, 09:51 PM
          0 responses
          1 view
          0 likes
          Last Post tgn55
          by tgn55
           
          Started by cxxazssx, Today, 09:45 PM
          0 responses
          1 view
          0 likes
          Last Post cxxazssx  
          Started by southpacific001, 02-26-2021, 09:25 PM
          14 responses
          64 views
          0 likes
          Last Post REI140205  
          Started by punkiy2111, Today, 05:22 PM
          0 responses
          3 views
          0 likes
          Last Post punkiy2111  
          Started by secrettrader, Today, 03:36 PM
          0 responses
          8 views
          0 likes
          Last Post secrettrader  
          Working...
          X