Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting string value from a string array in pine

I want to build a strategy for which I need to have the values of all stocks of a given index, let's say the DAX 30.

I'm building a string array with 30 values, each value being the ticker name of a DAX stock, e.g.:

var dax_names = array.new_string(30)
array.set(dax_names, 0, 'VOW3')
array.set(dax_names, 1, 'ADS')
...

Upon calling security(array.get(dax_names, i), 'D', close)) in a loop, the compiler complains that I'm sending a series string to security, as opposed to a string. Why does array.get() return a series string? How can I get the actual string value from my array?

like image 530
Giuliano Avatar asked Sep 16 '25 12:09

Giuliano


1 Answers

  1. You can't call security() from within a for loop.
  2. As the refman states, array.get() return series values.
  3. As the refman states, security() require a "simple string" argument for symbol, which means it cannot be a series.
like image 187
PineCoders-LucF Avatar answered Sep 19 '25 08:09

PineCoders-LucF