Reputation: 15
i am trying some simple for loop using hline but i get error as below:
Cannot call 'hline' with 'price'=series[integer]. The argument should be of type: input float
Script:-
for s = 0 to 2
hline(425 + s, title = "top line", color=color.green, linestyle=hline.style_solid, linewidth=2)
plot(close)
Can someone please help with this?
Upvotes: 1
Views: 4194
Reputation: 21342
You cannot use hline
in local scope.
Use line.new()
instead.
//@version=5
indicator("My script", overlay=true)
if barstate.islast
for s = 0 to 2
line.new(bar_index, 425 + s, bar_index + 1, 425 + s, extend=extend.both)
Upvotes: 0