Reputation: 343
Whenever I use line.new() and linefill.new() it draws over simple plot() and simple fill() no matter if I add option explicit_plot_zorder = true
var line baseLine = na
if na(baseLine) and not na(startPrice)
baseLine := line.new(bar_index - length + 1, startPrice, bar_index, endPrice, width = line_width, extend = extendStyle, color = color.new(baseColor, baseTransparency))
else
line.set_xy1(baseLine, bar_index - length + 1, startPrice)
line.set_xy2(baseLine, bar_index, endPrice)
line.set_color(baseLine, color.new(baseColor, baseTransparency))
na
...
var line upper = na
var line lower = na
fillColor = not fill_alternate ? color_upper : s <= 0 ? color_upper : color_lower
devTransparency = show_dev_lines ? transp_base : 100
if na(upper) and not na(upperStartPrice)
upper := line.new(bar_index - length + 1, upperStartPrice, bar_index, upperEndPrice, width = line_width, extend = extendStyle, color = color.new(fillColor, devTransparency))
else
line.set_xy1(upper, bar_index - length + 1, upperStartPrice)
line.set_xy2(upper, bar_index, upperEndPrice)
line.set_color(upper, color.new(fillColor, devTransparency))
na
if na(lower) and not na(lowerStartPrice)
lower := line.new(bar_index - length + 1, lowerStartPrice, bar_index, lowerEndPrice, width = line_width, extend = extendStyle, color = color.new(fillColor, devTransparency))
else
line.set_xy1(lower, bar_index - length + 1, lowerStartPrice)
line.set_xy2(lower, bar_index, lowerEndPrice)
line.set_color(lower, color.new(fillColor, devTransparency))
na
if show_dev_fill
linefill.new(upper, baseLine, color = fillColor)
linefill.new(baseLine, lower, color = not fill_alternate ? color_lower : fillColor)
...
plot(wt1, color = color.new(green, 35), style = plot.style_line, linewidth = 1)
This last plot ends up being in the background.
Using line.new() and linefill.new() always looks terrible with lines or even worse the fill ending up in the forground overdrawing everything :(
Upvotes: 0
Views: 495
Reputation: 865
The documentation says this below - I don't think this parameter has any impact on the line and line.fill objects unfortunately
explicit_plot_zorder (const bool) Specifies the order in which the script's plots, fills, and hlines are rendered. If true, plots are drawn in the order in which they appear in the script's code, each newer plot being drawn above the previous ones. This only applies to plot*()
functions, fill, and hline. Optional. The default is false.
Upvotes: 1