Mark pivots and zones on the chart, and show a small dashboard in the corner.
//@version=6 indicator("Drawings Demo", overlay = true, max_lines_count = 100, max_labels_count = 100) left = input.int(5, "Pivot left", minval = 1) right = input.int(5, "Pivot right", minval = 1) ph = ta.pivothigh(high, left, right) pl = ta.pivotlow(low, left, right) if not na(ph) label.new(bar_index - right, ph, str.tostring(ph, format.mintick), style = label.style_label_down, color = color.red, textcolor = color.white) line.new(bar_index - right, ph, bar_index, ph, color = color.red, style = line.style_dashed) if not na(pl) label.new(bar_index - right, pl, str.tostring(pl, format.mintick), style = label.style_label_up, color = color.green, textcolor = color.white) line.new(bar_index - right, pl, bar_index, pl, color = color.green, style = line.style_dashed) if barstate.islast box.new(bar_index - 20, ta.highest(high, 20), bar_index, ta.lowest(low, 20), border_color = color.blue, bgcolor = color.new(color.blue, 90))
line.new, label.new, box.new and polyline.new draw objects anchored to bars and prices. Each one returns a handle you can change later with its setters, for example line.set_x2(myLine, bar_index), or remove with line.delete(myLine).
line.new
label.new
box.new
polyline.new
line.set_x2(myLine, bar_index)
line.delete(myLine)
Scripts can keep up to 500 objects of each kind. When a script goes over its limit, the oldest object goes first. Set the limit you need in indicator(max_lines_count = ...).
indicator(max_lines_count = ...)
A table is drawn in a corner of the pane, not on the price axis, so it stays put when you scroll or zoom.
//@version=6 indicator("Table Dashboard", overlay = true) len = input.int(14, "Length", minval = 1) rsi = ta.rsi(close, len) atr = ta.atr(len) chg = (close - close[len]) / close[len] * 100 var table t = table.new(position.top_right, 2, 4, border_width = 1) if barstate.islast table.cell(t, 0, 0, "RSI", text_color = color.white, bgcolor = color.gray) table.cell(t, 1, 0, str.tostring(rsi, "#.0"), text_color = color.white, bgcolor = rsi > 70 ? color.red : rsi < 30 ? color.green : color.gray) table.cell(t, 0, 1, "ATR", text_color = color.white, bgcolor = color.gray) table.cell(t, 1, 1, str.tostring(atr, format.mintick), text_color = color.white, bgcolor = color.gray) table.cell(t, 0, 2, "Change", text_color = color.white, bgcolor = color.gray) table.cell(t, 1, 2, str.tostring(chg, "#.00") + "%", text_color = color.white, bgcolor = chg >= 0 ? color.green : color.red) table.cell(t, 0, 3, "Bars", text_color = color.white, bgcolor = color.gray) table.cell(t, 1, 3, str.tostring(bar_index + 1), text_color = color.white, bgcolor = color.gray)
Hover a label or a table cell that has a tooltip to read it.