Avi Singh
Avi Singh

Reputation: 5

Pine Script - Compare High / Low with Bollinger Band

I wanted to compare bollinger band top / bottom with high / low. How can I do so? I tried to compare with below

E=high[2]>=ta.bb(close[2],20,+2)
F=low[2]<=ta.bb(close[2],20,-2)

but it is not allowing. How do I rectify this?

Thanks

Upvotes: 0

Views: 1373

Answers (1)

G.Lebret
G.Lebret

Reputation: 3108

the pinescript function ta.bb() send back 3 series like this :

[middle, upper, lower] = ta.bb(close[2], 20, 20)

So in your code you should first calculate your 3 variables, and compare the variable that you want with your high or low, for example :

E = high[2] >= middle

Upvotes: 0

Related Questions