LabelHelper

Utility for managing active labels on the chart.
add(level, txt, labelColor, textColor) For displaying a lable at the last bar.
Parameters:
level: The value to display the label at.
txt: The text to show on the label.
labelColor: The color of the label.
textColor: The text color of the label.
Returns: The label being managed.
Updated:
add(level, txt, labelColor, textColor, tooltip) For displaying a label at the last bar.
Parameters:
level: The value to display the label at.
txt: The text to show on the label.
labelColor: The color of the label.
textColor: The text color of the label.
tooltip: The optional tooltip of the label.
Returns: The label being managed.
Updated:
add(level, txt, labelColor, textColor, offset, tooltip) For displaying a label at the last bar.
Parameters:
level: The value to display the label at.
txt: The text to show on the label.
labelColor: The color of the label.
textColor: The text color of the label.
offset: A positive value will push label to the right and a negative to the left.
tooltip: The optional tooltip of the label.
Returns: The label being managed.
Added:
refreshXPos(lbl, offset) Refreshes the x position of label.
Parameters:
lbl: The label to update.
offset: A positive value will push label one bar to the right and a negative value to the left.
Returns: The time value that was used.
create(level, txt, labelColor, textColor, size, textAlign, offset, tooltip) For creating a label at the last bar.
Parameters:
level: The value to display the label at.
txt: The text to show on the label.
labelColor: The background color of the label.
textColor: The text color of the label.
size: The size of the text. Default is large.
textAlign: The alignment of the text. Default is left.
offset: A positive value will push label to the right and a negative to the left.
tooltip: The optional tooltip of the label.
Returns: The label that was created.
Updated:
add(level, txt, labelColor, textColor, size, textAlign, offset, tooltip) For displaying a label at the last bar.
Parameters:
level: The value to display the label at.
txt: The text to show on the label.
labelColor: The background color of the label.
textColor: The text color of the label.
size: The size of the text. Default is large.
textAlign: The alignment of the text. Default is left.
offset: A positive value will push label to the right and a negative to the left.
tooltip: The optional tooltip of the label.
Returns: The label being managed.
.add(…) could leave a hanging label especially when values changed.
Added:
manage(src, txt, labelColor, textColor, size, textAlign, offset, tooltip) For displaying a label at the last bar.
Parameters:
src: The existing label to manage.
txt: The text to show on the label.
labelColor: The background color of the label.
textColor: The text color of the label.
size: The size of the text. Default is large.
textAlign: The alignment of the text. Default is left.
offset: A positive value will push label to the right and a negative to the left.
tooltip: The optional tooltip of the label.
Returns: The active label (or 'na' if no text was provided).
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.
Penafian
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.