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 love2code2trade, 04-17-2024, 01:45 PM
      4 responses
      31 views
      0 likes
      Last Post love2code2trade  
      Started by cls71, Today, 04:45 AM
      2 responses
      10 views
      0 likes
      Last Post eDanny
      by eDanny
       
      Started by proptrade13, Today, 11:06 AM
      0 responses
      4 views
      0 likes
      Last Post proptrade13  
      Started by kulwinder73, Today, 10:31 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by RookieTrader, Today, 09:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X