0

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

DarkBee
  • 16,592
  • 6
  • 46
  • 58
Avi Singh
  • 5
  • 6

1 Answers1

0

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
G.Lebret
  • 2,826
  • 2
  • 16
  • 27
  • So this means that I code to calculate upper and lower and middle BB values? Since I don't need middle, i can ignore that i guess? – Avi Singh Nov 24 '22 at 19:00
  • [middle, upper, lower]... this needs to be same order and all three written for formula to work!! never expected this. there is no need to code BB values. thank you for the guidance. – Avi Singh Nov 27 '22 at 17:54