Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

set up choice of colors for bool variable

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

    set up choice of colors for bool variable

    Hello,

    In the indicators properties parameters i would like my bool variables to have a choice of colors. Right now every line as a specific color in the chart. Want to be able to switch colors. Any pointers?

    Ty

    #2
    Hello frankduc,

    Can you provide more context about what you are trying to do? Bool is true/false that is not a color choice, did you mean Brush?

    If you are trying to create user selection for Plots or Lines that is not needed, Plots and Lines have a color selector present by default when using AddPlot or AddLine.

    Please let me know if I may be of further assistance.

    Comment


      #3
      Jesse,

      I am using
      Code:
       Draw.VerticalLine(this, "tag12", RfoundI, Brushes.Lime);
      If i click on the vertical line on the chart and switch to blue. As soon as the line is moving in the chart it return to Lime.

      I want the user to be able to change the color from lime to any choice available from the indicator parameters.

      Ty

      Comment


        #4
        Hello frankduc,

        You could make a Brush property for that use case.

        You can use the indicator wizard or strategy builder to generate brush properties. I would suggest doing it this way so you can have it auto generate the correct serialization property.

        From either the strategy builder or when you create a new indicator you will see the User Inputs section, from that area you can create a Brush user input. After generating the code you will have a public property along with a serialization property for your user input.



        Please let me know if I may be of further assistance.

        Comment


          #5
          What you are saying is to create a new indicator.
          In Input parameters i Name my variable RfoundI like in my previous example?
          Code:
          Draw.VerticalLine(this, "tag12", RfoundI, Brushes.Lime);
          I choose Type Brush
          Default orange

          and than copy / paste the rest of my indicator in the new indicator?

          Frank
          ty

          Comment


            #6
            Hello Frank,

            Yes, you can either generate a new indicator to generate and copy the code from that or you can see the sample in the help guide and copy that as well. The help guide explains what the wizards are generating. You can name the input anything you like so long as its not an already used term or name.


            Please let me know if I may be of further assistance.

            Comment


              #7
              Hello Jesse,

              I have a strange issue. Left corner of the chart. Indicator(ES9-20(1 minute)#FFF0FFFF, FFFF7F50, 2.27,2,1.61,FF008000, #FFFFC0CB, True,

              I mean where the FF0FFFF's is coming from. It seems related to the serialization property of my brushes color input?

              Frank
              TY

              Comment


                #8
                Hello frankduc,

                That is a color code.

                The color has been defined as an input so it is shown in the inputs string for the indicator and is showing the color value.

                If you want that removed or only want to show specific user inputs values in the indicators input string you can remove [NinjaScriptProperty] from any properties you don't want to show up. That removed it as a selection from outside the indicator I.E. when calling the indicator from another script or if this was used in a strategy with the strategy analyzer it would not be an optimization input.


                Please let me know if I may be of further assistance.

                Comment


                  #9
                  Can we remove the TRUE as well? It look silly there's like 8 True. I guess users dont need the bool result.

                  Comment


                    #10
                    Hello frankduc,

                    That would be up to you and how you design your properties. If you want to remove it you can it would be the same process. You can also review the DisplayName override if you want to make a custom string without modifying the properties. https://ninjatrader.com/support/help...ub=DisplayName

                    Please let me know if I may be of further assistance.

                    Comment


                      #11
                      Hello,

                      For example, in sample display barsgo file you can change manually :

                      Code:
                      NinjaTrader.Gui.Tools.SimpleFont simpleFont = chartControl.Properties.LabelFont ?? new NinjaTrader.Gui.Tools.SimpleFont("Verdana.ttf", 12);
                      Is it possible to give the user in indicator proprieties the option to change the font and the size, to change Verdana for Ariel or 12 for 20?

                      Ty

                      Comment


                        #12
                        Hello frankduc,

                        Its possible to create Int type properties for the size. The font can also be added by using a SimpleFont type or if you want the user to type in the font name it would have to be a string. There is a sample of working with fonts in the help guide that includes a property: https://ninjatrader.com/support/help...sub=simplefont



                        I look forward to being of further assistance.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        673 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        379 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        111 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        577 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        582 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X