当绘图为阶梯线样式时填充不正确
incorrect fill when plot is in stepline slyle
//@version=5
indicator(title="Weeks_OC", shorttitle="Weeks_OC", overlay=true)
w_close = request.security(syminfo.tickerid, "W", close, barmerge.gaps_off, barmerge.lookahead_on)
w_open = request.security(syminfo.tickerid, "W", open,barmerge.gaps_off, barmerge.lookahead_on)
p1=plot(w_open,title='w_open', color = w_close >= w_open ? color.blue : color.red, style=plot.style_stepline, linewidth=3)
p2=plot(w_close,title='w_close',color = w_close >= w_open ? color.blue : color.red, style=plot.style_stepline, linewidth=3)
fill(plot1=p1, plot2=p2, color = w_close >= w_open ? color.blue : color.red)
PineScript v5
显示一周开盘-收盘区域的简单指标。
当给定的图在 stepline slyle
中时,填充函数似乎无法正常工作
我认为您启用了延长营业时间。请切换到正常交易时间。
我想这就是您要找的:
//@version=5
indicator(title="Weeks_OC", shorttitle="Weeks_OC", overlay=true)
var int transp = input.int(50, 'Transparency', 0, 100)
var color c_blue = color.new(color.blue, transp)
var color c_red = color.new(color.red, transp)
[w_open,w_close] = request.security(syminfo.tickerid, 'W', [open,close], barmerge.gaps_off, barmerge.lookahead_on)
newWeek = ta.change(weekofyear)
mycolor = newWeek ? na : w_close >= w_open ? c_blue : c_red
p1 = plot(w_open, 'w_open', mycolor)
p2 = plot(w_close, 'w_close', mycolor)
fill(p1, p2, mycolor)
产生
//@version=5
indicator(title="Weeks_OC", shorttitle="Weeks_OC", overlay=true)
w_close = request.security(syminfo.tickerid, "W", close, barmerge.gaps_off, barmerge.lookahead_on)
w_open = request.security(syminfo.tickerid, "W", open,barmerge.gaps_off, barmerge.lookahead_on)
p1=plot(w_open,title='w_open', color = w_close >= w_open ? color.blue : color.red, style=plot.style_stepline, linewidth=3)
p2=plot(w_close,title='w_close',color = w_close >= w_open ? color.blue : color.red, style=plot.style_stepline, linewidth=3)
fill(plot1=p1, plot2=p2, color = w_close >= w_open ? color.blue : color.red)
PineScript v5
显示一周开盘-收盘区域的简单指标。 当给定的图在 stepline slyle
中时,填充函数似乎无法正常工作我认为您启用了延长营业时间。请切换到正常交易时间。
我想这就是您要找的:
//@version=5
indicator(title="Weeks_OC", shorttitle="Weeks_OC", overlay=true)
var int transp = input.int(50, 'Transparency', 0, 100)
var color c_blue = color.new(color.blue, transp)
var color c_red = color.new(color.red, transp)
[w_open,w_close] = request.security(syminfo.tickerid, 'W', [open,close], barmerge.gaps_off, barmerge.lookahead_on)
newWeek = ta.change(weekofyear)
mycolor = newWeek ? na : w_close >= w_open ? c_blue : c_red
p1 = plot(w_open, 'w_open', mycolor)
p2 = plot(w_close, 'w_close', mycolor)
fill(p1, p2, mycolor)
产生