Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PropertyDescriptor GetValue and SetValue

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

    PropertyDescriptor GetValue and SetValue

    From within an indicator, how can a BarsType property be accessed or modified?
    For the excerpt below what is the correct code for the "component" parameter?

    PropertyDescriptor pd = Bars.BarsType.Properties["BarsPeriodType"];
    pd.SetValue(component, "somevalue");
    string result = pd.GetValue(component);



    #2
    Hello fjwltn,

    What property are you trying to read? In general an indicator wont be able to modify any property on a BarsType, the BarsType is configured by the chart. You can read bars type properties, the easiest way is to use the Bars object.

    Comment


      #3
      The code is representative.
      I am utilizing the custom properties, so for discussion we'll use "Value2"

      PropertyDescriptor pd = Bars.BarsType.Properties["Value2"];

      In my custom BarsType class I successfully renamed it to "MyProperyName" and it is working as expected in the BarsType Properties dialog window.
      After renaming, the original property name must still be used to access it in the collection.
      That all works, and I get a properly populated PropertyDescriptor object with this code:
      PropertyDescriptor pd = Bars.BarsType.Properties["Value2"];

      However, nothing I have tried so far (this, Bars.BarsType, etc) works with GetValue or SetValue, with all attempts yielding the error "Object does not match target type"

      - Fred


      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 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
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X