barColorer
This tool lets you change the actual color of the candlesticks or bars on your chart. Instead of just adding lines or shapes, you can make the candles themselves turn green, red, yellow, or any color based on your rules.
For example:
Make candles green when the trend is bullish.
Make candles red when the trend is bearish.
Highlight special conditions like yellow candles during high volatility.
It’s a powerful way to make the chart itself tell a story at a glance.
Syntax
plot.barColorer(title, value, colors, id?)
Parameters
title
string— Name of this bar colorer (shown in settings).value
number— A value you pass in (often your condition’s result).colors
[{ color: string, name: string }]— A list of colors with labels. Example:{ color: "green", name: "Up" }.id
string(optional) — Custom identifier, if you want control over naming.
Return Value
{ value, id } — The bar colorer data and its identifier.
Example
Result

⚠️ ATTENTION ⚠️: When you change the bar color with barColorer, you may notice that the displayed color looks different from the one you selected. This happens because the base candle color underneath is still rendered. If you want a perfect match, adjust the background or transparency parameters to get the desired result.

Tips
Great for strategies — you can make the entire chart flash your signals by changing candle colors.
Use soft or transparent versions of colors if you don’t want to completely override the chart’s original look.
Warning
If you assign too many colors or confusing rules, your chart may look messy. Keep it simple.
Double-check your conditions — otherwise you might end up painting every bar the same color.
Last updated