我有一个简单的脚本,可以在最后的小节中找到需要的小节
//@version=3
study("My Script", overlay=true)
l = na
if barstate.islast
for i=0 to 100
if close[i] > open[i] and close[i+1] > open[i+1] and close[i+2] > open[i+2] and na(l)
l := high[i]
plot(l, color=lime, linewidth=3)
因此所需的值在en的3个位置。是否有可能从所需的小节开始生成并绘制序列。这就是我得到的。
我可以添加偏移量,但它只会将此行移到开头。
//@version=3
study("My Script", overlay=true)
l = na
offsetIndex = na
if barstate.islast
for i=0 to 100
if close[i] > open[i] and close[i+1] > open[i+1] and close[i+2] > open[i+2]and na(l)
offsetIndex := -i
l := high[i]
plot(l, color=lime, linewidth=3, offset=offsetIndex, show_last=3)