Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StrategyBaseConverter (Show / hide) properties in analysis

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

    StrategyBaseConverter (Show / hide) properties in analysis

    Hi.
    You can show and hide properties using the converter.

    This also works quite well.

    But when I'm in the optimazer, does that no longer work? Or did I do something wrong then?

    #2
    Hello 1001111,

    That would be expected, the optimizer has its own set of properties which allow the control of ranges. Inside the analyzer strategy based visual changes to the property grid would not be reflected.

    Comment


      #3
      HTML Code:
      public class DemoStrategyConverter : StrategyBaseConverter
      {
      
      public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attrs)
      {
      DemoStrategy strategy = component as DemoStrategy;
      
      PropertyDescriptorCollection propertyDescriptorCollection = base.GetPropertiesSupported(context)
      ? base.GetProperties(context, component, attrs)
      : TypeDescriptor.GetProperties(component, attrs);
      if (null == strategy || null == propertyDescriptorCollection)
      {
      return propertyDescriptorCollection;
      }
      
      #region Use Case Show/hide properties based on secondary input
      // These two values are will be shown/hidden (toggled) based on "ShowHideToggle" bool value
      PropertyDescriptor IntOrderStart = propertyDescriptorCollection["IntOrderStart"];
      
      // This removes the following properties from the grid to start off with
      propertyDescriptorCollection.Remove(IntOrderStart) ;
      
      // Now that We've removed the default property descriptors, we can decide if they need to be re-added
      // If "ShowHideToggle" is set to true, re-add these values to the property collection
      if (strategy.IsTradingTime)
      {
      propertyDescriptorCollection.Add(IntOrderStart);
      }
      
      // otherwise, nothing else to do since they were already removed
      #endregion
      
      return propertyDescriptorCollection;
      }
      
      public override bool GetPropertiesSupported(ITypeDescriptorContext context)
      { return true; }
      }

      This allows you to show and hide a property in a strategy.

      But then you can no longer use it in the optimizer because the property is no longer visible.

      How to make the property visible and selectable in the optimizer?

      Comment


        #4
        Hello 1001111,

        As mentioned that won't work in the analyzer and that is expected. You can see that code working when using the control center or a chart. The analyzer rebuilds the properties so that you can optimize them, visual customizations don't work there. If you are having problems because the type converter is working incorrectly in the analyzer it would be suggested to disable that part of the type converter or to not use it while you use the analyzer.

        Comment


          #5
          OK thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          53 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X