Probably really simple code, but I can t seem to get this to work.
I am trying to use bgcolor to paint the background of the 10th candle from the current candle.
Here is what I have:
// Define the number of candles to count back candlesToCountBack = 10
// Calculate the index of the 5th candle from the current candle candleIndex = bar_index - candlesToCountBack
// Condition to check if the current candle is the 5th candle isTenthCandle = bar_index == candleIndex
bgcolor(color = isTenthCandle ? color.red: na)
I was expecting a red background on the 10th candle, but this code doesn t result in anything. What could be off, or is it even possible?
Thanks!