English 中文(简体)
Tradingview Pinescript - bgcolor on the 10th candle from the current candle
原标题:

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!

问题回答

暂无回答




相关问题
I m trying to write pinescript to locate side by side candles

Brother candles as per image so the candles open and close values are about the same one bullish, one bearish eg. close of candle 1 = open candle 2 open candles 2 = close candle 1 hope someone may ...

Using if statement when input is selected in pinescript

I have a drop down menu via inputs that should control the backgroundcolor when changed. As a simple example, when I select the 200/200 from the drop down list, I want the background color to use the ...

为什么用文字计算错误?

我写了一个文字,比较了两种符号之间百分比差异的演变,但我可以说明为什么计算错误。

热门标签