Reputation: 822
Can anyone explain line no. 3 and 4 in this code?
1 //@version=4
2 study("array.new_line example",overlay = true)
3 plot(bar_index)
4 line.new(bar_index-1, close[1], bar_index, close,width =2)
I expected the line from start. Because bar indexing starts from 0 on the first historical bar. But its showing as different. why?
line.new(bar_index-1, close[1], bar_index, close,width =2)
I have read the documentation. But still not get the answer.
https://www.tradingview.com/pine-script-reference/v4/#fun_line{dot}new
Upvotes: 1
Views: 673
Reputation: 21342
study()
, indicator()
and strategy()
have an argument called max_lines_count
. This determines the number of last line drawings displayed. By default it is set to 50
.
Once you have more lines, it will start deleting the old ones to create the new ones. You can set it to 500
and you will see all the lines on your chart (BANKNIFTY @1M
).
Upvotes: 2