I'm using economic data in TradingView in column type chart. The values can be positive and negative (differently of prices values that can not be negative).
I need a Pine Editor script for to color bars based on positive and negative values.
I tried the following code, but it did not work.
//@version=5
indicator("Positive/Negative Column Coloring", overlay=true)
// Determine the color of the columns based on positive and negative values
columnColor = close >= 0 ? color.green : color.red
// Plotting the columns with the appropriate color
plotbar(close, color=columnColor)
// Plotting the closing price as a line
plot(close, title="Close", color=color.blue)
Thank you.