Reference10 min read
Functions for rendering data on charts with customizable styling, colors, and visual effects.
Overview
| Function | Description |
|---|---|
plotLine() | Draw continuous lines |
plotBar() | Render vertical bars |
plotCandle() | Display OHLC candlesticks |
plotShape() | Add markers and shapes |
hline() | Draw horizontal reference lines |
plotText() | Add text labels |
plotTable() | Display data tables |
plotRange() | Draw range/band areas |
plotBgColor() | Color background areas |
plotLine()
Render data as continuous lines with customizable styling.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
value | any | Data to plot |
width | number | Line width (default: 1) |
colors | string[] | Array of colors |
colorIndex | number | Index to select color |
fill | boolean | Fill area below line |
smooth | boolean | Apply smoothing |
label | string[] | Labels for legend |
desc | string[] | Descriptions |
Example

plotLine example showing two moving averages
plotBar()
Render data as vertical bars (histograms).Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
value | any | Data to plot |
width | number | Bar width (default: 1) |
colors | string[] | Array of colors |
colorIndex | number | Index to select color |
label | string[] | Labels for legend |
desc | string[] | Descriptions |
Example

plotBar example showing colored volume bars
plotCandle()
Render OHLC data as candlestick charts.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
value | TimeSeries | OHLC data (requires Open, High, Low, Close) |
width | number | Candle width (default: 1) |
colors | string[] | Colors for bullish/bearish |
label | string[] | Labels |
desc | string[] | Descriptions |
Example

plotCandle example showing OHLC candlesticks
plotShape()
Add shapes and markers at specific points.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
value | any | Y-position for shapes |
shape | string | Shape type: “circle”, “triangle”, “square”, “diamond” |
width | number | Shape size |
colors | string[] | Shape colors |
fill | boolean | Fill shape |
label | string[] | Labels |
desc | string[] | Descriptions |
Example

plotShape example showing buy signal markers
hline()
Draw horizontal reference lines at fixed values.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Y-value for the line |
color | string | Line color |
width | number | Line width |
style | string | ”solid”, “dashed”, “dotted” |
label | string | Label text |
Example

hline example showing RSI with reference levels
plotTable()
Display data in a table format on the chart.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
data | any[][] | 2D array of table data |
position | string | Table position: “top_left”, “top_right”, “bottom_left”, “bottom_right” |
colors | object | Color configuration |
Example

plotTable example showing indicator values
plotBgColor()
Color the chart background based on conditions.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
color | string | Background color (use alpha for transparency) |
condition | boolean | When to apply the color |
Example

plotBgColor example showing trend-based background coloring
Tips
Label Requirement
Label Requirement
Every plot function requires a
label parameter. Missing labels will cause warnings.Color Arrays
Color Arrays
Use color arrays with
colorIndex for conditional coloring:Multiple Plots
Multiple Plots
You can use multiple plot functions in a single indicator to create complex visualizations.
Performance
Performance
Avoid creating too many plot calls in loops. Each plot adds rendering overhead.