Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add transparency to "Brush" statement

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

    Add transparency to "Brush" statement

    I have been trying to find the syntax to add a transparency statement to my Brush statement, see code below....

    BackBrush = Brushes.Lime;
    EnterLong(Convert.ToInt32(Qty), @"Long Entry");

    Thanks

    #2
    Hello mlarocco,

    Are you asking how to use a transparent brush? If so that is one of the options for Brushes:

    Code:
    BackBrush = Brushes.Transparent;

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello mlarocco,

      Are you asking how to use a transparent brush? If so that is one of the options for Brushes:

      Code:
      BackBrush = Brushes.Transparent;
      Sorry, I wasn't very clear. I think the proper term would have been, I want to set opacity on the Brush, so it will still show but not be full color.

      Thanks

      Comment


        #4
        Hello mlarocco,

        You can find information about working with opacity here: https://ninjatrader.com/support/help...gcustombrushes

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello mlarocco,

          You can find information about working with opacity here: https://ninjatrader.com/support/help...gcustombrushes
          Thanks but I cannot get it to work...

          Comment


            #6
            Hello mlarocco,

            What did you try?

            If you can provide a sample of what you tried that did not work we may be able to assist further.

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello mlarocco,

              What did you try?

              If you can provide a sample of what you tried that did not work we may be able to assist further.
              I tried adding SolidColorBrush(Color.FromRgb(56, 120, 153)); to the BackBrush statement, but no matter what I tried, it wouldn't compile. I am completely lost

              Comment


                #8
                Hello mlarocco,

                Can you post a copy of what you tried specifically along with the error you are seeing? We can't help with a problem if we don't have the code or know what error you are running into.



                Comment


                  #9
                  Originally posted by NinjaTrader_Jesse View Post
                  Hello mlarocco,

                  Can you post a copy of what you tried specifically along with the error you are seeing? We can't help with a problem if we don't have the code or know what error you are running into.


                  Here is the original code that works...
                  // Set 1
                  if (High[0] == (Open[0] + (4 * TickSize)) )
                  {
                  BackBrush = Brushes.Blue;
                  }

                  However the stripe is full color, I would like it to have some transparency (opacity). I've tried this...
                  // Set 1
                  if (High[0] == (Open[0] + (4 * TickSize)) )
                  {
                  BackBrush = (Color.FromRgb(56, 120, 153));
                  }

                  and get a CS0029 error

                  Tried this...
                  // Set 1
                  if (High[0] == (Open[0] + (4 * TickSize)) )
                  {
                  BackBrush = Brush(Color.FromRgb(56, 120, 153));
                  }

                  Get a CS0118 error

                  Really don't know why it has to be so difficult to do a simple thing!

                  Comment


                    #10
                    Hello mlarocco,

                    It looks like the code you are trying to use is not like the code in the help guide sample, here is the sample again:

                    Code:
                    Brush myBrush = new SolidColorBrush(Color.FromArgb(100, 56, 120, 153));
                    myBrush.Freeze();
                    These two lines create a new Brush. You can the use the myBrush wherever that is needed:

                    Code:
                    Brush myBrush = new SolidColorBrush(Color.FromArgb(100, 56, 120, 153));
                    myBrush.Freeze();
                    BackBrush = myBrush;

                    Comment


                      #11
                      Originally posted by NinjaTrader_Jesse View Post
                      Hello mlarocco,

                      It looks like the code you are trying to use is not like the code in the help guide sample, here is the sample again:

                      Code:
                      Brush myBrush = new SolidColorBrush(Color.FromArgb(100, 56, 120, 153));
                      myBrush.Freeze();
                      These two lines create a new Brush. You can the use the myBrush wherever that is needed:

                      Code:
                      Brush myBrush = new SolidColorBrush(Color.FromArgb(100, 56, 120, 153));
                      myBrush.Freeze();
                      BackBrush = myBrush;
                      Alright, I got it to work. Thanks for the help!!

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Mindset, 04-21-2026, 06:46 AM
                      0 responses
                      90 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by M4ndoo, 04-20-2026, 05:21 PM
                      0 responses
                      136 views
                      0 likes
                      Last Post M4ndoo
                      by M4ndoo
                       
                      Started by M4ndoo, 04-19-2026, 05:54 PM
                      0 responses
                      68 views
                      0 likes
                      Last Post M4ndoo
                      by M4ndoo
                       
                      Started by cmoran13, 04-16-2026, 01:02 PM
                      0 responses
                      120 views
                      0 likes
                      Last Post cmoran13  
                      Started by PaulMohn, 04-10-2026, 11:11 AM
                      0 responses
                      69 views
                      0 likes
                      Last Post PaulMohn  
                      Working...
                      X