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 mjairg, 07-20-2023, 11:57 PM
      3 responses
      213 views
      1 like
      Last Post PaulMohn  
      Started by TheWhiteDragon, 01-21-2019, 12:44 PM
      4 responses
      544 views
      0 likes
      Last Post PaulMohn  
      Started by GLFX005, Today, 03:23 AM
      0 responses
      3 views
      0 likes
      Last Post GLFX005
      by GLFX005
       
      Started by XXtrader, Yesterday, 11:30 PM
      2 responses
      12 views
      0 likes
      Last Post XXtrader  
      Started by Waxavi, Today, 02:10 AM
      0 responses
      7 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Working...
      X