• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 otislauwaert, Today, 03:56 AM
1 response
4 views
0 likes
Last Post NinjaTrader_PatrickG  
Started by Erwin Beckers, Yesterday, 10:03 PM
1 response
7 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by Erwin Beckers, Yesterday, 09:56 PM
1 response
6 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by TraderYoda, Today, 05:59 AM
1 response
5 views
0 likes
Last Post TraderYoda  
Started by AnotherTrader, Today, 05:07 AM
0 responses
3 views
0 likes
Last Post AnotherTrader  
Working...
X