从pine中的字符串数组中提取字符串值 [英] Extracting string value from a string array in pine
本文介绍了从pine中的字符串数组中提取字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想制定一种策略,我需要掌握给定指数(例如DAX 30)的所有股票的价格.
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.
我正在构建一个包含30个值的字符串数组,每个值都是DAX股票的股票名称,例如:
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')
...
在循环中调用 security(array.get(dax_names,i),'D',close))
后,编译器抱怨我向安全性发送了一系列字符串,与之相反到一个字符串.为什么array.get返回一个系列字符串?如何从数组中获取实际的字符串值?
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?
提前谢谢!
推荐答案
- 您不能在
for
循环中调用security()
. - 作为 refman状态,
array.get()
返回序列值. - 由于 refman状态,
security()
需要一个简单字符串"symbol
的参数,这意味着它不能为序列.
- You can't call
security()
from within afor
loop. - As the refman states,
array.get()
return series values. - As the refman states,
security()
require a "simple string" argument forsymbol
, which means it cannot be a series.
这篇关于从pine中的字符串数组中提取字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文