> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# StrategyBaseConverter Class

## Definition

A custom **TypeConverter** class handling the designed behavior of a strategy's property descriptor collection. Use this as a base class for any custom TypeConverter you are applying to a strategy class.

Notes:

* A working NinjaScript demo can be found through the reference sample on "[Using a TypeConverter to Customize Property Grid Behavior](http://ninjatrader.com/support/forum/showthread.php?t=97919)"
* When applying the custom converter, you must fully qualify the name (e.g., "NinjaTrader.NinjaScript.Strategies.MyCustomConveter")
* Additional TypeConverter information can be found from the [MSDN documentation](https://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter%28v=vs.110%29.aspx)
* See also [TypeConverterAttribute](/developer/desktop-sdk/references/common/attributes/typeconverterattribute)
* For Indicators, see the [IndicatorBaseConverter](/developer/desktop-sdk/references/indicator/indicatorbaseconverter) class

## Relevant base methods

| Method                                                                                                                                                         | Description                                                                                                                                           |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| [TypeConverter.GetProperties()](https://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.getproperties\(v=vs.110\).aspx)                   | When overriding GetProperties(), calling base.GetProperties() ensures that all default property grid behavior works as designed                       |
| [TypeConverter.GetPropertiesSupported()](https://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.getpropertiessupported\(v=vs.110\).aspx) | In your custom converter class, you must override GetPropertiesSupported() and return a value of true in order for your custom type converter to work |

## Syntax

`public class StrategyBaseConverter : TypeConverter`

Failure to apply a type of `StrategyBaseConverter` on a strategy class can result in unpredictable behavior of the standard NinjaTrader WPF property grid.

Tip: Common strategy functions like `Print()` are not available to a type converter instance. To debug a type converter class, you can use the AddOn [Debug Concepts](/developer/desktop-sdk/references/add-on/alert-and-debug-concepts) or [attach to a debugger](/developer/desktop-sdk/guides/ninjascript-editor-overview/visual-studio-debugging) (recommended)

## Examples

```csharp
// This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
   // When applying the type converter, you must fully qualify the name
   [TypeConverter("NinjaTrader.NinjaScript.Strategies.MyCustomConveter")]
   public class MyCustomStrategy : Strategy
   {
     protected override void OnStateChange()
     {
         if (State == State.SetDefaults)
         {
           Name                             = "MyCustomStrategy";
         }
     }

     protected override void OnBarUpdate()
     {
         //Add your custom strategy logic here.
     }
   }

   // custom converter class for strategies
   public class MyCustomConveter : StrategyBaseConverter
   {
     // A general TypeConveter method used for converting types
     public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object component, Attribute[] attrs)
     {
         // sometimes you may need the strategy instance which actually exists on the grid
         MyCustomStrategy strategy = component as MyCustomStrategy;

         // base.GetProperties ensures we have all the properties (and associated property grid editors)
         // NinjaTrader internal logic handles for a given strategy
         PropertyDescriptorCollection propertyDescriptorCollection = base.GetPropertiesSupported(context)
                 ? base.GetProperties(context, component, attrs) : TypeDescriptor.GetProperties(component, attrs);

         if (strategy == null || propertyDescriptorCollection == null)
           return propertyDescriptorCollection;

         // example of why you may need the instance that exists on the grid....
         if (strategy.EntryHandling == EntryHandling.UniqueEntries)
         {
           // do something in the event a property contains some value...
         }

         // Loop all of the properties of the strategy
         foreach (PropertyDescriptor property in propertyDescriptorCollection)
         {
           // do something with a specific property

           // cannot call **Print()** here
           // but you can call the static Output window "Process()"
           NinjaTrader.Code.Output.Process(property.Name, PrintTo.OutputTab1);
         }

         // must return the collection after making changes
         return propertyDescriptorCollection;
     }

     // Important:  This must return true otherwise the type converter will not be called
     public override bool GetPropertiesSupported(ITypeDescriptorContext context)
     { return true; }
   }
}
```