Array of stings (ticker codes) - converting "string series" to "simple string"
Posted: Sun Jan 16, 2022 5:56 pm
Hi - I have a challenge I hope one of you can help me with ...
in an indicator script, I would like to build a (predefined) list of ticker-symbols/strings (eg "NASDAQ:AAPL" as part of a NASDAQ ticket list) and use these in the script values as inputs to the request.security() function - eg ala
var symbol_array = array.new_string(25, "" )
if barstate.isfirst
<indent> array.set(symbol_array, 0, "NASDAQ:AAPL")
float symbol_close = request.security(array.get(symbol_array, 0), timeframe='D', expression=close)"
// to be equivalent to "request.security("NASDAQ:AAPL", timeframe='D', expression=close)"
the problem is that array.get() returns a "string series" and the request.security() expects a "simple string" as parameter
so how do I "convert" the "string series value" to a "simple string" ??
or is there another way to define such a list of symbols not using arrays?
or??
Thanks in advance
Claus from Denmark
in an indicator script, I would like to build a (predefined) list of ticker-symbols/strings (eg "NASDAQ:AAPL" as part of a NASDAQ ticket list) and use these in the script values as inputs to the request.security() function - eg ala
var symbol_array = array.new_string(25, "" )
if barstate.isfirst
<indent> array.set(symbol_array, 0, "NASDAQ:AAPL")
float symbol_close = request.security(array.get(symbol_array, 0), timeframe='D', expression=close)"
// to be equivalent to "request.security("NASDAQ:AAPL", timeframe='D', expression=close)"
the problem is that array.get() returns a "string series" and the request.security() expects a "simple string" as parameter
so how do I "convert" the "string series value" to a "simple string" ??
or is there another way to define such a list of symbols not using arrays?
or??
Thanks in advance
Claus from Denmark