Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color Input Param in Strat Analyzer showing hex nbr, not button to open Color Picker.

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

    Color Input Param in Strat Analyzer showing hex nbr, not button to open Color Picker.

    Hi NinjaTrader Technical Support,

    The following code causes the "MyColor" input parameter below to show up as an editable hexadecimal number "#FFFF0000" in the Strategy Analyzer input parameters property grid rather than a nice color button that when clicked allows the user to pick a color from a color picker dialog box.

    Code:
    // In the "protected override void OnStateChange()" method...
    if (State == State.SetDefaults)
    {
    ...
    MyColor = Color.FromArgb(255, 255, 0, 0);
    ...
    }
    
    // In the list of Input Parameters for the Strategy...
    [NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name="Color", Description="", Order=1, GroupName="NinjaScriptStrategyParameters")]
    public Color MyColor { get; set; }
    How can I make the "MyColor" input parameter above show up as a nice color button that when clicked allows the user to pick a color from a color picker dialog box?

    Thanks in advance!

    EquityTrader

    #2
    Hello EquityTrader,

    Thanks for the post.

    NT8 uses Brushes for color input specifically so other C# color types like Color won't have a nice editor like brush does. You would need to make a brush property for it to show up as a list of colors.

    If you are trying to create a custom brush with alpha you can find some examples in the following page of use and also serialization.



    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse,

      Thanks! Your answer was just what I needed. I was able to follow the help documentation you recommended to get a Brush that is visible in the Input Parameters section of a Strategy in the Strategy Analyzer, and it has a nice color drop-down list editor instead of a hexadecimal number like #FFFF0000.

      Thanks again,

      EquityTrader

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      52 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