Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator : Using a TypeConverter to Customize Property Grid Behavior

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

    Indicator : Using a TypeConverter to Customize Property Grid Behavior

    The default behavior of the NinjaTrader 8 property grid is designed to handle the most basic display of your custom Indicator and Strategy properties. However, there are special cases where you may want to control how unique properties display to other users. Since using a TypeConverter is more of a general C# concept used to convert values between data types (a string to an enum for example), so the possibilities of what you can do are within the bounds of the .NET Framework. This NinjaScript sample was produced to help NinjaScript developers understand how to leverage the IndicatorBaseConverter and StrategyBaseConverter helper classes to customize property grid behavior without affecting general NinjaTrader 8 property behavior.

    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
    1. Show / hide properties based on secondary input
    2. Disable / enable properties based on secondary input


    2. Customizing how a property is displayed
    1. Display "Friendly" enum values
    2. Re-implement a "bool" CheckBox as "Friendly" a ComboBox
    3. Display a custom collection / list with user defined values at run time


    Important related documentation:

    C#


    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
    1. Download the file contained in this thread to your PC desktop
    2. From the Control Center window, select the menu Tools > Import > NinjaScript Add-On
    3. Select the downloaded zip file


    Additional resources:
    MSDN - How to: Implement a Type Converter
    Attached Files
    Last edited by NinjaTrader_Bertrand; 05-17-2018, 03:02 AM.
    BertrandNinjaTrader Customer Service

Latest Posts

Collapse

Topics Statistics Last Post
Started by Christopher_R, Today, 12:29 AM
0 responses
8 views
0 likes
Last Post Christopher_R  
Started by sidlercom80, 10-28-2023, 08:49 AM
166 responses
2,235 views
0 likes
Last Post sidlercom80  
Started by thread, Yesterday, 11:58 PM
0 responses
3 views
0 likes
Last Post thread
by thread
 
Started by jclose, Yesterday, 09:37 PM
0 responses
7 views
0 likes
Last Post jclose
by jclose
 
Started by WeyldFalcon, 08-07-2020, 06:13 AM
10 responses
1,415 views
0 likes
Last Post Traderontheroad  
Working...
X