bbnm
bbnm

Reputation: 1094

Pine Script How to add title to conditional colors

plot(close, "Close", close > EMA200 ? color.green : color.red)

How do I add titles for the colors used if I'm using conditional colors like the code above?

enter image description here

On the Style tab, it just displays the colors as Color 0 and Color 1.

Upvotes: 0

Views: 456

Answers (1)

Chris Buckett
Chris Buckett

Reputation: 14378

Don't think you can directly (at least I don't remember seeing an example of named colours on the Styles tab).

You can put conditional colour settings on the Inputs tab, eg:

col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")
col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")

(the example taken from the built-in MACD indicator)

Built-in macd filter showing named colours in the Inputs tab

Upvotes: 1

Related Questions