'Pine: bug with the label.new function
If you execute this code on RUNEUSD:
//@version=5
indicator("MA", "", true)
if (bar_index > 5000 and bar_index < 5800)
label.new(bar_index, open,"🠅", yloc = yloc.belowbar, style = label.style_none, textcolor = color.blue, size = size.normal)
plot(na, "Zero line", color.gray)
you will notice blue arrows appearing below the bars (between bars 5000 and 5800).
But if you change the range with 4000 and 5000 like so:
if (bar_index > 4000 and bar_index < 5000)
No bar will appear at all!
I really cannot understand why, any idea ?
Thank you
Solution 1:[1]
They do appear but they don't start at index #4000. That is because you can only have a limited amount of labels on your chart. Default value is 50.
If you want to increase that add max_labels_count=500 to your indicator() call.
indicator("MA", "", true, max_labels_count=500)
The separate chart plots bar_index.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vitruvius |


