Note:
- NinjaTrader 8 expects custom properties to be of value type or type which implements ICloneable interface
- This reference sample assumes you are familiar with basic C# TypeConverter practices and is intended as a starting point. There are extensive 3rd party guides available online which can help you implement a particular type converter goal not covered in this sample
Key concepts in this example:
There are 5 use cases demonstrated in this sample which fall into two different categories:
1. Dynamically manipulate what is displayed on the UI Property Grid
- Show / hide properties based on secondary input
- Disable / enable properties based on secondary input
2. Customizing how a property is displayed
- Display "Friendly" enum values
- Re-implement a "bool" CheckBox as "Friendly" a ComboBox
- Display a custom collection / list with user defined values at run time
Important related documentation:
C#
- ICloneable Interface
- PropertyDescriptor Class
- RefreshPropertiesAttribute
- TypeConverter Class
- DisplayAttribute Class
NinjaTrader 8
IndicatorBaseConverter Class
StrategyBaseConverter Class
TypeConverterAttribute
Note: The reference sample files on this page are written for an indicator using the IndicatorBaseConverter class, but the same key concepts are available to strategies by replacing the StrategyBaseConverter where noted in the sample code
NinjaTrader 7
Not applicable
Import instructions:
NinjaTrader 8
- Download the file contained in this thread to your PC desktop
- From the Control Center window, select the menu Tools > Import > NinjaScript Add-On
- Select the downloaded zip file
Additional resources:
MSDN - How to: Implement a Type Converter