我了解到,request.security()是为更高的时间框架数据调用和更低的request.security_lower_tf()优化的。但是,在输入部分中,我只想显示一个input.timeframe,并编写策略,自动在较高和较低的安全调用之间切换。
longMTF_HT = request.security(syminfo.tickerid, inputTimeframe, longCondition[1], barmerge.gaps_off, barmerge.lookahead_on)
shortMTF_HT = request.security(syminfo.tickerid, inputTimeframe, shortCondition[1], barmerge.gaps_off, barmerge.lookahead_on)
longMTF_LT = request.security_lower_tf(syminfo.tickerid, inputTimeframe, longCondition)
shortMTF_LT = request.security_lower_tf(syminfo.tickerid, inputTimeframe, shortCondition)
longMTF = timeframe.period < inputTimeframe ? longMTF_HT : longMTF_LT
shortMTF = timeframe.period < inputTimeframe ? shortMTF_HT: shortMTF_LT
上面的代码返回错误:
line 39: Cannot call 'operator ?:' with argument 'expr2'='shortMTF_LT'. An argument of 'bool[]' type was used but a 'series bool' is expected
寻找解决方案
发布于 2022-09-19 09:49:42
因为他们会给你不同的价值观。不幸的是,TradingView并没有很好地记录它。
request.security()
-会还给你的。一个来自较高时间框架的close
值,因为这个简单的值很容易地适合您的时间帧序列浮点数
request.security_ltf()
-将为您返回一个 close
values数组,这些值都分组在一起,将适合您当前的时间序列浮点数数组。
因此,与分组、更详细的ltf数据相比,导入的数据少/相等。
对于ltf导入,您需要一些数组操作/循环来处理所有内容。
https://stackoverflow.com/questions/73761211
复制相似问题