如何更改绘制前一天高/低线的自定义变量的线条样式?松文字
我正在创建一个指标来绘制前一天的高点和低点线。我已经按应有的方式编写了代码和数据图,但我无法更改线条样式。它默认为虚线,但我想要一条实线。我知道我正确使用了绘图函数,并且在定义线条样式时我使用了正确的输入。我唯一能想到的是我正在定义自己的变量,因此它不允许我更改线条样式。请帮忙!
//Yesterday high and low
bool afterHours = hour < 20 and hour >= 16 or hour == 20 and minute <= 00
bool preHours = hour < 9 and minute <= 30 or hour >= 4 or hour == 4
bool marketHours = hour > 9 and minute >= 30 and hour < 16 and minute <= 00
//Current High And Low
currentdayhigh = request.security(syminfo.tickerid, 'D', high[0])
currentdaylow = request.security(syminfo.tickerid, 'D', low[0])
//Yesterday high and low
previousdayhigh = request.security(syminfo.tickerid, 'D', high[1])
previousdaylow = request.security(syminfo.tickerid, 'D', low[1])
if preHours
previousdayhigh := currentdayhigh
previousdaylow := currentdaylow
if marketHours
previousdayhigh := previousdayhigh
previousdaylow := previousdaylow
if afterHours
previousdayhigh := currentdayhigh
previousdaylow := currentdaylow
plot(previousdayhigh, style=plot.style_line, title='Yesterday\'s high', color=color.new(#ffdf00, 0), linewidth=1, trackprice=true, offset=k)
pdh = label.new(x=time + td, y=previousdayhigh, text='PREVIOUS HIGH', xloc=xloc.bar_time, style=label.style_none, textcolor=#ffdf00, size=size.small, textalign=text.align_right)
label.delete(pdh[1])
plot(previousdaylow, style=plot.style_line, title='Yesterday\'s low', color=color.new(#ffdf00, 0), linewidth=1, trackprice=true, offset=k)
pdl = label.new(x=time + td, y=previousdaylow, text='PREVIOUS LOW', xloc=xloc.bar_time, style=label.style_none, textcolor=#ffdf00, size=size.small, textalign=text.align_right)
label.delete(pdl[1])
I am creating an indicator the charts previous day high and low lines. I have written the code and the data plots as it should, but I am unable to change the line style. It is defaulting to a dotted line, but I want a solid line. I know I am using the plot function correctly and in defining the line style I am using the correct input. The only thing I can think of that I am defining my own variable so it won't allow me to change the line style. Please help!
//Yesterday high and low
bool afterHours = hour < 20 and hour >= 16 or hour == 20 and minute <= 00
bool preHours = hour < 9 and minute <= 30 or hour >= 4 or hour == 4
bool marketHours = hour > 9 and minute >= 30 and hour < 16 and minute <= 00
//Current High And Low
currentdayhigh = request.security(syminfo.tickerid, 'D', high[0])
currentdaylow = request.security(syminfo.tickerid, 'D', low[0])
//Yesterday high and low
previousdayhigh = request.security(syminfo.tickerid, 'D', high[1])
previousdaylow = request.security(syminfo.tickerid, 'D', low[1])
if preHours
previousdayhigh := currentdayhigh
previousdaylow := currentdaylow
if marketHours
previousdayhigh := previousdayhigh
previousdaylow := previousdaylow
if afterHours
previousdayhigh := currentdayhigh
previousdaylow := currentdaylow
plot(previousdayhigh, style=plot.style_line, title='Yesterday\'s high', color=color.new(#ffdf00, 0), linewidth=1, trackprice=true, offset=k)
pdh = label.new(x=time + td, y=previousdayhigh, text='PREVIOUS HIGH', xloc=xloc.bar_time, style=label.style_none, textcolor=#ffdf00, size=size.small, textalign=text.align_right)
label.delete(pdh[1])
plot(previousdaylow, style=plot.style_line, title='Yesterday\'s low', color=color.new(#ffdf00, 0), linewidth=1, trackprice=true, offset=k)
pdl = label.new(x=time + td, y=previousdaylow, text='PREVIOUS LOW', xloc=xloc.bar_time, style=label.style_none, textcolor=#ffdf00, size=size.small, textalign=text.align_right)
label.delete(pdl[1])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您指的是“trackprice”行,则无法更改此行样式。仅点状
If you are referring to the 'trackprice' line then you cannot change this line style. Dotted only