首页 > 解决方案 > 内置函数“highestbars”有错误吗?

问题描述

这是一个简单的测试来证明这个问题:

//@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)

这是意外的输出

标签: built-inpine-script

解决方案


利用:

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

推荐阅读