我想在最后 5 个小节周围创建一个盒子。我只想在图表上画一个框。
我已经写了这段代码,但它不起作用。
// @version=5
indicator("One Box", overlay=true)
var int left = na
if barstate.islast
left := bar_index-5
top = ta.highest(5)
bottom = ta.lowest(5)
box.new(left= left ,top= top, right= bar_index, bottom= bottom)
非常感谢
我编辑了我的代码,这就是答案:我更改了 if 块的位置
// @version=5
indicator("One Box", overlay=true)
left = bar_index[4]
top = ta.highest(5)
bottom = ta.lowest(5)
if barstate.islast
box.new(left= left ,top= top, right= bar_index, bottom= bottom)