Basically I am trying to make an indicator if the volume is above average then the candlestick is 100% opacity but if the volume is below average the candlestick the opacity is 50%. I am stuck as I can’t seem to change the opacity of the bar
//@version=5
indicator("Bar Opacity Based on Volume", overlay=true)
avgVolume = ta.sma(volume, 60)
volumeAboveAvg = volume > avgVolume
currentColor = color.new(color.blue, 100)
barcolor(color.new(currentColor, volumeAboveAvg ? 0 : 100))
This is what I have so far it changes the bar color to blue. I’m also not sure how to make the whole bar change color it’s just the body
New contributor
user25080133 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.