0

I understand the error message but i wanted to know why wouldn't this be something possible to do in pinescript?

[ [supertrend, direction], [middle, upper, lower] ] = request.security( 'BA' , 'D' , [ ta.supertrend(3, 10), ta.bb(close, 20, 2) ])
saleem
  • 41
  • 4

1 Answers1

1

First of all, pine script has many limitations. I suppose you consider the declaration side to be or behave like an array. But pine script works only with tuple declarations that you may use in case you have multiple values to return. Tuples are common in programming languages.

[value1, value2] = testFunction() => [32, "foo"] Because of the brackets it may look like an array, but it's actually a collection of values.
Note that pine script does not support multidimensional arrays either.

elod008
  • 1,227
  • 1
  • 5
  • 15
  • I was able to workaround it, i copied the supertrend and bollinger bands functions from the technical analysis library and merged them into one custom function and then i returned `[supertrend, direction, middle, upper, lower]` – saleem Nov 22 '22 at 09:16