Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Parameter Color default

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

    Parameter Color default

    ​I want to specify a default color for a rectangle color parameter I have defined. It works but I have to select a color first.

    Ninja doesn't like: "RectangleColor = Colors.Blue;"

    [XmlIgnore]
    public System.Windows.Media.Brush RectangleColor { get; set; }
    [Display(Name="RectangleColor", Order=1, GroupName="Parameters")]

    [Browsable(false)]
    public string BrushSerialize
    {
    get { return Serialize.BrushToString(RectangleColor); }
    set { RectangleColor = Serialize.StringToBrush(value); }
    }

    ​Also in the parameters the color picker shows under a "Misc" GroupName and not "Parameters" even though I specified a "GroupName="Parameters")]"
    Click image for larger version

Name:	image.png
Views:	199
Size:	16.3 KB
ID:	1239254

    Ninja 8.0 colors are going to ​be the death of me of me yet I just know it.

    Cheers
    Attached Files

    #2
    Hello, thanks for writing in. The NetChangeDisplay indicator has an example you can reference:

    Code:
            [XmlIgnore]
            [Display(ResourceType = typeof(Custom.Resource), Name = "PositiveColor", GroupName = "NinjaScriptIndicatorVisualGroup", Order = 1810)]
            public Brush PositiveBrush { get; set; }
    
            [Browsable(false)]
            public string PositiveBrushSerialize
            {
                get { return Serialize.BrushToString(PositiveBrush); }
                set { PositiveBrush = Serialize.StringToBrush(value); }
            }​
    In State.SetDefaults, this is set to PositiveBrush = Brushes.LimeGreen;

    Comment


      #3
      NinjaTrader_ChrisL

      Thanks. Showed me exactly how to do it. Works like a champ now.

      Cheers

      Comment


        #4
        Very helpful. A pro in the making! Very soon!

        Comment


          #5
          JulietLisbon

          Juliet, Just curious. Where on the planet are you located? I am in New Zealand.

          Cheers

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          152 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          305 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          244 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          345 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          176 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X