Signature
plot(series, title, color, linewidth, style, trackprice, histbase, offset,
join, editable, show_last, display, format, precision, force_overlay,
linestyle)
| Parameter | Type | Default | Meaning |
|---|---|---|---|
series |
series float / int | required | The value to plot. na on a bar hides the point. |
title |
const string | "" |
Appears in the legend and the Style tab. |
color |
series color | #2962FF |
Line / fill colour. Can vary per bar. |
linewidth |
const int | 1 |
1–4. |
style |
const | plot.style_line |
See Styles. |
linestyle |
const | plot.linestyle_solid |
plot.linestyle_dashed, plot.linestyle_dotted. |
trackprice |
const bool | false |
Draw a dotted horizontal line at the last value across the whole pane. |
histbase |
const float | 0 |
Baseline for style_histogram / style_columns / style_area. |
offset |
const int | 0 |
Shift the plot n bars left/right. |
join |
const bool | true |
Join segments across na bars (false → style_linebr-like gaps). |
editable |
const bool | true |
false hides the Style tab row for this plot. |
show_last |
const int | – | Render only the last N bars. |
display |
const | display.all |
Where the value appears (pane, data window, price scale, status line). |
format |
const | format.inherit |
Label number format. |
precision |
const int | – | Decimal places. |
force_overlay |
const bool | false |
Pin this plot to the price pane even in an oscillator script. |
Styles
| Style | Rendered as |
|---|---|
plot.style_line |
continuous line (default) |
plot.style_linebr |
line with gaps across na bars |
plot.style_stepline |
step line (horizontal between bars) |
plot.style_stepline_diamond |
step with diamond markers at each step |
plot.style_histogram |
vertical bars from histbase to value |
plot.style_columns |
thick histogram (thick volume columns) |
plot.style_cross |
× marker at each bar |
plot.style_circles |
◯ marker |
plot.style_area |
filled area between histbase and value |
plot.style_areabr |
style_area with gaps across na |
Examples
//@version=1
indicator("Plot gallery", overlay=false)
plot(close - open, "Body (histogram)", style=plot.style_histogram, color=close > open ? color.lime : color.red)
plot(math.avg(open, close), "Body midpoint", color=color.aqua, linewidth=2)
plot(math.min(open, close), "Body low (step)", color=color.navy, style=plot.style_stepline, linewidth=3)
plot(math.max(open, close), "Body high (dot)", color=color.gray, style=plot.style_circles, linewidth=3)
Multi-colour MA:
ma = ta.alma(hl2, 40, 0.85, 6)
var color almaColor = color.silver
almaColor := ma > ma[2] ? color.lime : ma < ma[2] ? color.purple : almaColor
plot(ma, "Two-colour ALMA", color=almaColor, linewidth=2)
Dashed guide:
plot(2.0, "Upper guide", color=color.new(color.orange, 25), linestyle=plot.linestyle_dashed)
plot(-2.0, "Lower guide", color=color.new(color.orange, 25), linestyle=plot.linestyle_dashed)
show_last for a trailing window
Render only the last N bars — handy for anchored volume profiles or last-value level overlays:
plot(ta.ema(close, 20), "EMA 20", color=color.aqua, trackprice=true, show_last=1)
display
Control which chart surfaces show the plot:
plot(close, display=display.pane) // pane only (default)
plot(volume, display=display.data_window + display.pane) // pane + the Data Window read-out
plot(delta, display=display.status_line + display.pane) // pane + the top-of-chart status line
plot(rsi, display=display.all - display.price_scale) // everywhere except the right scale
Combine modes with +; subtract with -.
offset for lead/lag
plot(ta.sma(close, 20), "SMA 20 forward 10 bars", offset=10)
A positive offset shifts the plot into the future, a negative one into the past.
Dynamic colours
The color argument is a series value — it can change bar to bar:
diff = close - ta.sma(close, 20)
plot(diff, "Deviation", color=diff >= 0 ? color.lime : color.red)
For many-color palettes see Colors.
See also
- Fills
- Bar plotting —
plotcandleandplotbar - Text and shapes —
plotshape,plotchar,plotarrow - Levels —
hlinefor horizontal reference levels