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 NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      65 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      139 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      75 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      45 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      50 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X