我目前被困在pine脚本中,试图获得特定时间段的最高和最低,比如说0000到0400
pdh = security(tickerid, 'D', high)
pdl = security(tickerid, 'D', low)这让我们看到了今天的最高点和最低点。请注意,这是使用pine脚本V4。
发布于 2020-01-21 17:39:33
//@version=4
study("Highest of first 4 bars in timezone GMT-5, different from tz of symbol")
t = timestamp("GMT-5", year, month, dayofmonth, hour, minute, second)
highest = -1.0
if hour(t) > 4
highest := nz(highest[1], -1)
else
for i = 0 to 1000
if na(t[i]) or hour(t[i]) > 4
break
highest := max(highest, high[i])
plot(highest)我认为它看起来应该类似于上面的代码。也许它的工作方式并不完全像我期望的那样(我既没有调试也没有测试它),但我想你自己实现所需的特性就足够了。
https://stackoverflow.com/questions/59835738
复制相似问题