Lines, labels, boxes, tables, fills between lines and polylines — made, moved and deleted by a script, drawn by Bentrix in the study's pane.
Besides plotting a value on every bar, a script can make objects: a line between two points, a label at a price, a box, a table of figures, a fill between two lines, a polyline through many points. Each *.new call answers a handle the script keeps, moves (line.set_xy2, label.set_text, box.set_right …) and deletes (line.delete).
var line lastHigh = na
ph = ta.pivothigh(high, 5, 5)
if not na(ph)
line.delete(lastHigh)
lastHigh := line.new(bar_index - 5, ph, bar_index, ph, color = color.orange, extend = extend.right)
label.new(bar_index - 5, ph, str.tostring(ph, format.mintick), style = label.style_label_down)
01Where they are drawn
Bentrix draws a script's objects in the study's own pane — over the price for an overlay study. Each point's x is a bar index, or a time with xloc = xloc.bar_time; Bentrix reads it against the bars the study stands on, so an object lands where a person's drawing at that moment would — on every chart type, including those built by price.
- lineBetween two points, with its extend, style, width and arrowheads.
- labelA tag pointing at its price; on the price pane, above or below its bar.
- boxWith its fill, border and extend.
- tableAt one of the pane's nine places, its cells with their text, colours and sizes.
- linefillThe space between two lines, between their ends.
- polylineThrough its points, straight or curved (a curve through the points, Bentrix's own).
02What a forming candle draws
An object made or changed on the newest bar is redrawn at each tick, as the bar forms; what a closed candle drew stands.
03How many
Each kind keeps at most its count — max_lines_count, max_labels_count, max_boxes_count in the declaration, 50 by default and at most 500; past it, the oldest goes. Nothing of a script's drawing can be dragged or edited by hand: it is the script's.