Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    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 adeelshahzad, Today, 03:54 AM
      5 responses
      32 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by stafe, 04-15-2024, 08:34 PM
      7 responses
      32 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by merzo, 06-25-2023, 02:19 AM
      10 responses
      823 views
      1 like
      Last Post NinjaTrader_ChristopherJ  
      Started by frankthearm, Today, 09:08 AM
      5 responses
      20 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      43 views
      0 likes
      Last Post jeronymite  
      Working...
      X