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.

    https://ninjatrader.com/support/help...th_brushes.htm

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    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 bosajin, Today, 09:51 AM
      0 responses
      4 views
      0 likes
      Last Post bosajin
      by bosajin
       
      Started by Newant, Today, 08:13 AM
      1 response
      18 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by alejandro888, Yesterday, 10:14 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by devro, Yesterday, 07:00 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by mr_trade, Today, 07:13 AM
      0 responses
      18 views
      0 likes
      Last Post mr_trade  
      Working...
      X