3

I am trying to read symbols (strings) from an array, but array.get returns a series[string] object, while security only accepts simple strings. I tried casting to string, but it still gives a "series[string] argument is not accepted" error. Is there a way to make this work?

//@version=4
study("etfa", shorttitle = 'etfa', max_bars_back=500, overlay = false)
length=input(40, title="length", type=input.integer)
sFunc(length) =>
    kkl=stoch(close,high,low,length)
    kkl
aaa=array.new_float(0,0)
aa=array.new_string(4, "text")
array.set(aa,0,"AAPL")
array.set(aa,1,"MSFT")
array.set(aa,2,"AMZN")
array.set(aa,3,"GOOGL")




for i = 0 to 3
    
    k=array.get(aa,i)
    r=string(k)
    rr=security(r, timeframe.period,sFunc(length))
    array.push(aaa,rr)
Will Bir
  • 35
  • 1
  • 4

1 Answers1

2

I'm afraid this is not possible in Pine for the moment.
The security function needs a non-mutable string as the input for the ticker.
There's no way around that for the moment afaik.

Bjorn Mistiaen
  • 6,459
  • 3
  • 18
  • 42