Draws a series on the chart as a line, histogram, columns, area, circles or steps, and returns a plot handle that fill can use.
plot draws one value per bar from series. Where the value is na, the default line style joins the last value before the gap to the first one after it, and plot.style_linebr leaves the line open across the gap. Histogram and column styles draw nothing at na. The call registers the plot once, using the title, style, linewidth and offset it has on its first bar; the color can change on every bar.
A plot appears in the legend and Data Window under its title, in the order of the plot calls in the script. The call returns a plot handle you can pass to fill, and Pine allows at most 64 plots per script.
A bool series is drawn as 1 for true and 0 for false.
Syntax
plot(series: series int/float, title: const string (optional), color: series color (optional), linewidth: input int (optional), style: input plot_style (optional), trackprice: input bool (optional), histbase: input int/float (optional), offset: simple int (optional), join: input bool (optional), editable: input bool (optional), show_last: input int (optional), display: input plot_display (optional), format: input string (optional), precision: input int (optional), force_overlay: const bool (optional), linestyle: input plot_line_style (optional)) -> plotArguments
| Name | Type | Default | Description |
|---|---|---|---|
| series | series int/ | required | Series to draw. Numbers, or a bool drawn as 1 and 0. |
| title | const string | "Plot N" | Name shown in the legend and Data Window. |
| color | series color | #2962FF | Series color, so it can change per bar. na hides that bar's segment. |
| linewidth | input int | 1 | Line thickness in pixels. A whole number of 1 or more. |
| style | input plot_style | plot. | Drawing style, a plot.style_* constant: line, linebr, stepline, stepline_diamond, steplinebr, histogram, columns, circles, cross, area or areabr. |
| trackprice | input bool | false | Accepted for compatibility and ignored. |
| histbase | input int/ | 0.0 | Base level that histogram, columns and area styles draw from. |
| offset | simple int | 0 | Shifts the plot by this many bars; negative values move it to the left, into the past. |
| join | input bool | false | Accepted for compatibility and ignored. |
| editable | input bool | true | Accepted for compatibility and ignored. |
| show_last | input int | na | Accepted for compatibility and ignored. |
| display | input plot_display | display. | Where the plot is shown. display.none keeps it out of the chart. |
| format | input string | format. | Accepted for compatibility and ignored. |
| precision | input int | na | Accepted for compatibility and ignored. |
| force_overlay | const bool | false | When true, draws on the main chart pane even if the script runs in its own pane. |
| linestyle | input plot_line_style | plot. | Accepted for compatibility and ignored. |
Returns
plot: a plot handle, accepted by fill.
Remarks
- On Sidechair: stepline, stepline_diamond and steplinebr draw as step lines, with point markers added for the diamond style. circles and cross draw as dots, area and areabr draw as a filled area from histbase, and histogram and columns both draw as a histogram. steplinebr and areabr break at na the way linebr does.
- On Sidechair: the arguments trackprice, join, show_last, format, precision and linestyle are accepted without effect, and a title left out becomes "Plot 1", "Plot 2" and so on by call order.
- On Sidechair: line widths above 4 are drawn as 4.
- Plot colors can use transparency:
color.new(color.red, 70).
Example
//@version=6
indicator("Plot styles")
change = ta.change(close)
plot(change, "Change", color = change >= 0 ? color.teal : color.maroon, style = plot.style_columns)
plot(ta.sma(change, 10), "Average", color = color.orange, linewidth = 2)See also
Runs on Sidechair