Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting Input Brushes Programmatically

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

    Getting Input Brushes Programmatically

    Hi,

    how does one get the brushes from the indicator input without explicitly calling them?

    Code:
    Color1 = Brushes.Orange; Color2 = Brushes.Salmon; Color3 = Brushes.SeaGreen; Color4 = Brushes.SlateBlue; Color5 = Brushes.MediumOrchid; Color6 = Brushes.MediumBlue; Color7 = Brushes.Black; Color8 = Brushes.Teal; Color9 = Brushes.Goldenrod; Color10 = Brushes.SaddleBrown; ... // I want to avoid this Brush[] brushes = { Color1, Color2, Color3, Color4, Color5, Color6, Color7, Color8, Color9, Color10}; // I want this, this.Inputs is not the right one foreach (Brush brush in this.Inputs) { Print("this brush is: " + brush.ToString()); }
    Also is it possible for a user to dynamically specify how many brush inputs fields they can choose?


    Thanks
    Last edited by NinjaTrader_ChrisL; 10-08-2020, 09:02 AM.

    #2
    Hello WestonMicah, thanks for your post.

    The number of brush inputs must be defined at compile-time, there is no way to dynamically add brush inputs. You can make a Brush public property like so:

    Code:
            [XmlIgnore]
            public Brush DownColor { get; set; }
    
            [Browsable(false)]
            public string DownColorSerialize
            {
              get { return Serialize.BrushToString(Dow nColor); }
              set { DownColor = Serialize.StringToBrus h(value); }
            }
    To know the color of the brush you would just compare DownColor against a pre-defined brush.

    Please let me know if this does not resolve your inquiry.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    36 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X