Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing bar color gradient

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

    Changing bar color gradient

    Hi Support,

    How can I color my bars dynamically to vary (in a gradient way) from 2 colors like gray to green based on a certain calculation at the time.

    thanks

    #2
    Hi Hawk, thanks for posting.

    We have an example of gradient bars based on RSI here:

    This is a basic sample on how to implement a color gradient to your charts price bars using an RSI for the calculations. Converted from NT7 version provided by jortuzar.


    Kind regards,
    -ChrisL

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    Comment


      #3
      thanks for quick response,

      1. Is there a way to see the code of these ecosystem indicators without downloading them on to your platform? My concern is that there might be some sort of malicious dll that is attached and I don't want to find out after it's downloaded on my platform.

      2.I've looked thru the forum regarding the RSI gradient color change and it appeared to to what I want except it could only vary between red, blue or Green. Is there a way to vary between 2 preset colors like Gray and Green?

      3. I tried using the LinearGradientBrush but I'm guessing that's not the correct way of accomplishing this?

      Comment


        #4
        Hi Hawk1,

        1. You can download the .zip then look within the .zip file and use your preferred code editor to view the script. We do not allow .dll files to be uploaded to the Ecosystem website or forum and most browsers will warn if there is a .dll file in a zip file when you download it. Visual Studio Code also has a protected view by default when you open files.

        2. The code within the script will need to be modified for custom colors. The colors are calculated within OnBarUpdate i.e. on each bar so to change for custom colors would take a few specific changes to the RGB calculations taking place.

        3. LinearGradientBrush does not apply here because BarBrush is a Brush type. On each bar the BarBrush color is set based on the RSI value. When you group the bars together it looks like a gradient.

        Kind regards,
        -ChrisL
        ​​​​​

        Comment


          #5
          Perfect, Thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          579 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X