我目前正在编写一个脚本,该脚本应该绘制出当前价格之上的最低过去阻力。 如果价格仍然高于价格,我正在尝试绘制n个最后一个阻力中的最低阻力,但是无论价格如何,我都很难绘制它。你有什么建议吗 ? 这就是我目前所拥有的:
//@version=4
study("lowest resistance", overlay=true)
topf = high[3] < high[2] and high[2] > high[1] and high[1] > high[0]
top(n)=> var float z = na, z := valuewhen(topf,high[2],n)
plot(top(0),offset=-2)
plot(top(1),offset=-2)
plot(top(2),offset=-2)
minR(n)=>
x= 100000.
for i = 0 to n
x:=min(x,top(i))
x
plot(minR(2), color=color.red, offset=-2)
问题在于top(n)(无论n是什么)都能很好地绘制,但是min()函数似乎没有返回最低值,而仅返回top(0)。 我想念什么吗?
而且,如果价格仍高于当前价格/收盘价,我如何才能获得最低的过去阻力?
提前谢谢!