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

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
    Unsuitable
    NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

    #2
    Hello Unsuitable,

    For custom inputs you make there is not a collection for those, you could instead make your own collection like you have shown to do that.

    If these are specifically Plot colors you could reference the Plots collection, for other brushes like you have shown the best approach is also what you have shown.

    Also is it possible for a user to dynamically specify how many brush inputs fields they can choose?
    Not as a Brush property but you could make a List and then create brushes from that. More than likely the best solution is just going to be individual inputs for simplicity. There is an example of creating more complex properties in the following link: https://ninjatrader.com/support/help...r_to_custo.htm

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Not as a Brush property but you could make a List and then create brushes from that. More than likely the best solution is just going to be individual inputs for simplicity. There is an example of creating more complex properties in the following link: https://ninjatrader.com/support/help...r_to_custo.htm
      Yeah that's a whole can of worms that I don't want to open... I'll stick with a fixed number of brushes.

      Thanks
      Unsuitable
      NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ETFVoyageur, Today, 02:10 AM
      0 responses
      8 views
      0 likes
      Last Post ETFVoyageur  
      Started by rayyyu12, Today, 12:47 AM
      0 responses
      8 views
      0 likes
      Last Post rayyyu12  
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      17 responses
      137 views
      0 likes
      Last Post ETFVoyageur  
      Started by ETFVoyageur, Yesterday, 10:13 PM
      1 response
      11 views
      0 likes
      Last Post ETFVoyageur  
      Started by somethingcomplex, Yesterday, 10:36 PM
      0 responses
      10 views
      0 likes
      Last Post somethingcomplex  
      Working...
      X