刚刚学会绘制前一天的高点和低点。它为完成的会话绘制了很好的图,但仍继续绘制每根蜡烛的高低(当前会话)。我发现这分散了我的注意力。我使用5分钟图表。代码(v4):
1. // Previous day high low
2. plotDHL = input(title="Plot PDH PDL", type=input.bool, defval=true)
3. pdh = security(syminfo.tickerid, 'D', high)
4. pdl = security(syminfo.tickerid, 'D', low)
5. cDHL = color.new(#f21bf2, 40)
6. plot(series=plotDHL ? pdh : 0, title = "PDH", style = myStyle, linewidth = 1, color = cDHL)
7. plot(series=plotDHL ? pdl : 0, title = "PDL", style = myStyle, linewidth = 1, color = cDHL)
答案 0 :(得分:1)
我不确定我的答案是否可行,但是您可以使用:
a = security(syminfo.tickerid, 'D', high)
b = 0.
b := barstate.islast ? b[1] : a