Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Gradient Color Bars

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

    Gradient Color Bars

    Hello,

    I downloaded the RSI Gradient Color indicator (https://ninjatraderecosystem.com/use...olor-gradient/) and it calculates as follows using only RGB:
    Code:
    double rsiValue = RSI(Period, Smooth)[0];
    
                int rgbGreen = 0;
                int rgbRed   = 0;
                int rgbBlue  = 0;
    
                rgbRed       = (int) (255*(rsiValue)/100);
                rgbGreen = 255-rgbRed;
                //rgbBlue = 255-rgbRed;//To use blue values 
    
                BarBrush = new SolidColorBrush(Color.FromArgb((byte)255, (byte)rgbRed,(byte)rgbGreen,(byte)rgbBlue));
    Is there a way to add a High Heat Color & a Low Heat Color for the gradient?

    Thank you.

    #2
    Hello KINGKODA,

    Thanks for your post.

    The purpose of the indicator is basically to demonstrate a dynamic way of providing color based, in this case, on the variable value of an RSI.
    You can certainly add code to produce what you consider to be High./Low heat.
    I recommend that you test by replacing the rsiValue with the values of interest to produce the effect of interest.
    You can probably find better but here is a reference to an RGB color wheel: https://simple.wikipedia.org/wiki/Color_wheel towards the bottom of that page are a dozen colors and their RGB values.

    Comment


      #3
      Thanks Paul,

      Replacing the rsiValues would not produce the effect I'm interested in... I know that the strength of the RSI will affect the gradient... I want to use it with the RSI and not any other indicator... What I am looking to do is give myself the option of choosing between 2 colors for the gradient.

      For Example:
      Code:
      Brush highHeatColor = Brushes.RoyalBlue;
      Brush lowHeatColor = Brushes.Yellow;
      It would be similar to the Heat in OrderFlow Volume Profile. Is there a way to achieve what I am looking to add?

      Comment


        #4
        Hello KINGKODA,

        Thanks for your reply.

        What you would need to do is to obtain the RGB codes for those two colors and then adjust the coding to give the range of values between them. Here is a link to a color picker where you can see the RGB codes. https://www.google.com/search?q=hex+...hrome&ie=UTF-8 You can also google search for other color wheels.

        Comment


          #5
          Hello,
          please tell me how to solve the limitation of the number(65535) of colored bars here :
          BarBrush = new SolidColorBrush(Color.FromArgb((byte)255, (byte)rgbRed,(byte)rgbGreen,(byte)rgbBlue));

          Comment


            #6
            Hello olchik,

            Thanks for your post.

            The number of unique brushes is fixed at 65535, so to solve the issue you would have to work within that predefined limitation.

            With reference to the example indicator, on each new bar, it will automatically create a new brush regardless if the brush value had been previously created/used. As soon as you have a dataseries with more than 65535 bars you would exceed the limit.

            You could look at some means to store the unique brush and then compare the values that are used to calculate that brush and compare each new calculation to see if indeed you need to create a unique brush or has one has already been created and use that existing brush instead of continually creating a new one as the example does.

            You could also expand the range of values (from the RSI) that it takes to create a unique brush.

            It is still possible that at some point you could exceed to limitation.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            605 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            351 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X