Plots and drawings
plot styles, levels and fills, background and bar colours, and label/line/box/table objects.
| Call | Draws |
|---|---|
plot(x, style=plot.style_line) | A line; also step line, area, histogram, columns, circles, cross |
plot(h, color=h >= 0 ? color.green : color.red) | A per-bar colour |
hline(70, "Overbought") | A fixed level |
fill(p1, p2, color=...) | Shading between two plots or two levels |
bgcolor(cond ? color.new(color.red, 90) : na) | A background band on selected bars |
barcolor(color.orange) | Recolours the candle |
plotshape(cond, style=shape.triangleup, location=location.belowbar) | A marker on selected bars |
Drawings follow Pine's object API. A drawing created on every bar is created again on every bar, so keep one in a var and move it, or create it only on the last bar.
//@oxscript=1
indicator("Day high", overlay=true)
var line hiLine = na
var label hiLabel = na
dayHigh = ta.highest(high, 75)
if barstate.islast
line.delete(hiLine)
label.delete(hiLabel)
hiLine := line.new(bar_index - 20, dayHigh, bar_index, dayHigh, color=color.orange, width=2)
hiLabel := label.new(bar_index, dayHigh, "High " + str.tostring(dayHigh), style=label.style_label_down)
plot(close, "Close", color=color.gray)Drawing budget
Each drawing kind keeps 50 objects by default, like Pine. Raise it with max_lines_count, max_labels_count or max_boxes_count in the header, up to 500. The oldest is removed first.