在 plotchar 的帮助下标记线

label line with help of plotchar

伙计们,我需要帮助在我的脚本中添加标签,借助“plotchar”,昨天的高线和低线带有文本 H 和 L,我已经尝试过自己但是在图表上得到多个标签,如图所示 picture 1 , i tried using show_last but it will show label on only on last bar and its kinda messy on live chart picture 2 , i want this text to be displayed on left side of the line , like in this picture picture 3 这个标签是用“plotchar”完成的,不幸的是这是一个受保护的脚本,任何人都知道如何复制与图 3 中所示相同的结果的解决方案,这是我的脚本

//@version=4
study("daily high low ?", overlay=true)

hl = input(true, title="Show Previous Day Highs & Lows", group="KETAN ULTIMATE COMBO")

dhigh = security(syminfo.tickerid, "D", high[1], lookahead=true)
dlow = security(syminfo.tickerid, "D", low[1], lookahead=true)
plot(timeframe.isintraday and hl ? dhigh : na, title="Daily High", style=plot.style_stepline, color=color.rgb(255,0,0), linewidth=2)
plot(timeframe.isintraday and hl ? dlow : na, title="Daily Low", style=plot.style_stepline, color=color.rgb(0,128,0), linewidth=2)

plotchar(timeframe.isintraday and hl ? dhigh : na, title="high", location=location.absolute,color=color.blue, char = "", text ="H")
plotchar(bar_index ? dlow : na , title="low", location=location.absolute, color=color.blue, char = "", text ="L")

谢谢

我没有检查你的所有代码,但你可以检测到一天已经改变 change(dayofmonth)

//@version=4
study("daily high low ?", overlay=true)

hl = input(true, title="Show Previous Day Highs & Lows", group="KETAN ULTIMATE COMBO")

dhigh = security(syminfo.tickerid, "D", high[1], lookahead=true)
dlow = security(syminfo.tickerid, "D", low[1], lookahead=true)
plot(timeframe.isintraday and hl ? dhigh : na, title="Daily High", style=plot.style_stepline, color=color.rgb(255,0,0), linewidth=2)
plot(timeframe.isintraday and hl ? dlow : na, title="Daily Low", style=plot.style_stepline, color=color.rgb(0,128,0), linewidth=2)

plotchar(change(dayofmonth) ? dhigh : na, title="high", location=location.absolute,color=color.blue, char = "", text ="H")
plotchar(change(dayofmonth) ? dlow : na , title="low", location=location.absolute, color=color.blue, char = "", text ="L")