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

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

Good Practice

Last updated