隐藏 Pine脚本中的信号标签

huangapple go评论60阅读模式
英文:

Hiding signal labels via pine script

问题

在Pine Script中是否有一种直接隐藏信号标签的方法?我知道你可以在设置中取消勾选该框,但每次脚本刷新时,我的整个图表都会变得混乱。我想保留用于交易列表中的调试信号内容,只是想将它们从图表中移除。

英文:

Is there a way to hide the signal labels directly via pine script? I know you can uncheck the box in the settings, but each time the script refreshes my hole chart is cluttered. I do want to keep the signal contents for debugging in the trade list, just want them removed from the graph.

隐藏 Pine脚本中的信号标签

答案1

得分: 2

// 为了调试,您可以将以下代码添加到您的代码的末尾:

// 删除所有标签
label.new(bar_index, close)
a_allLabels = label.all
if array.size(a_allLabels) > 0
	for i = 0 to array.size(a_allLabels) - 1
		label.delete(array.get(a_allLabels, i))

这将删除您的代码绘制的所有标签。
参见:https://www.tradingview.com/pine-script-reference/v5/#var_label%7Bdot%7Dall

英文:

For your debugging purpose you can add it at the end of your code :

//delete all labels
label.new(bar_index, close)
a_allLabels = label.all
if array.size(a_allLabels) > 0
	for i = 0 to array.size(a_allLabels) - 1
		label.delete(array.get(a_allLabels, i))

It will delete all the labels drawn by your code.
see : https://www.tradingview.com/pine-script-reference/v5/#var_label%7Bdot%7Dall

huangapple
  • 本文由 发表于 2023年4月11日 13:47:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75982721.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定