Вот простой тест для демонстрации проблемы:
//@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)
Вот неожиданный вывод .