内置函数“ highestbars”是否有错误?

问题描述 投票:0回答:1

这是演示问题的简单测试:

//@version=4
study("Triangle",overlay=false)

length=input(title="Length",type=input.integer,defval=244)
long=input(title="Distance from 1 high",type=input.integer,defval=80)

x1=int(0)

x1:=-1*highestbars(length)>long?-1*highestbars(length):0
plot(x1,color=color.purple)

这里是unexpected output

built-in pine-script
1个回答
0
投票

用途:

h = highestbars(length)
x1:=-1*h>long?-1*h:0

并且请参阅Why do some functions and built-ins evaluate incorrectly in if or ternary (?) blocks?以获取说明。

© www.soinside.com 2019 - 2024. All rights reserved.