Drawing on the chart
Plots, fills, boxes, Fibonacci, profiles, tables and dashboards.
plot ema(close, fast) as fast_line, color: if trend_up then green else red, width: 2plot (high + low) / 2, color: gray, style: stepfill ribbon.fast, ribbon.slow, color: green.fade(80)hline 70, style: dashed, color: #22c55emark arrow_up, at: below, when: crosses_above(close, ema(close, fast)), color: greenlabel "Entry", at: (bar.index, high)line from: (bar.index - 20, lowest(low, 20)), to: (bar.index, lowest(low, 20)), extend: rightbox id: "range", from: (bar.index - 10, highest(high, 10)), to: (bar.index, lowest(low, 10)), color: blue.fade(85)bar_color if close > open then green else redbackground red.fade(90), when: regime == Regime.volatileprofile rows: 24, range: session, side: rightfib from: (bar.index - 50, lowest(low, 50)), to: (bar.index, highest(high, 50))dashboard position: top_right, rows: [["Regime", "{regime}"], ["Triggers", "{triggers}"]]There are 26 drawing commands. Each is documented under Drawing commands.
- Give a drawing an
id:to update the same object on later bars instead of adding a new one. - Positions are written as
(bar, price)pairs, such as(bar.index - 20, lowest(low, 20)). - Colours: ten named colours, hex values,
.fade(percent), andgradient,linear_gradientandradial_gradient.
The canvas
When no command fits, on render(canvas) gives you a vector canvas for the visible range: paths, lines, fills and text.
on render(canvas):for z in levels:shape = canvas.path()shape.move_to(z.formed_at, z.price)shape.line_to(canvas.last_bar, z.price)shape.stroke(zone_color, width: 1)canvas.text("{z.touched}x", at: (canvas.last_bar, z.price), align: right)Examples: Volatility Regime Canvas, Volume Heatmap, Multi-Timeframe Trend Table, Opening Range Dashboard.