plot_shape
Syntax Format
plot(series, plot_shape_style, plot_shape_size, shape_color, plot_shape_location, offset, text, text_color)
Overview
The plot_shape
function creates shapes on the chart, whose values and their purpose depend on the conditions, which you set in the script. You will mostly use this function while creating signals or other entry points indications, as the shapes will help you highlight the needed data.
Parameters
Parameter | Type | Purpose | Default State |
---|---|---|---|
series | series . The values are treated as boolean , if the plot_shape_style is not shape_location.absolute | Input series | - |
name | string | The plot name | series.name |
plot_shape_style | shape_style | The style of the shape | shape_style.xcross |
plot_shape_size | shape_size | The size of the shape | shape_size.auto |
shape_color | color | The color of the shape | "white" |
plot_shape_location | shape_location | The location of the shape | shape_location.abovebar |
offset | integer | The offset in bars to shift the shape left or right | 0 |
text | string | The text to display | "" |
text_color | color | The color of the text to display | "white" |
Shapes and colors can be conditional and customized, depending on the asset price movement.
Shape Style
You can use the following enum value items to declare the shape style on the plot:
Enum Item | Purpose | Result |
---|---|---|
shape_style.arrowdown | Arrow down shape | ![]() |
shape_style.arrowup | Arrow up shape | ![]() |
shape_style.circle | Circle shape | ![]() |
shape_style.cross | Cross shape | ![]() |
shape_style.diamond | Diamond shape | ![]() |
shape_style.flag | Flag shape | ![]() |
shape_style.labeldown | Label down shape | ![]() |
shape_style.labelup | Label up shape | ![]() |
shape_style.square | Square shape | ![]() |
shape_style.triangledown | Triangle down shape | ![]() |
shape_style.triangleup | Triangle up shape | ![]() |
shape_style.xcross | X Cross shape | ![]() |
Syntax Format
plot_shape(close > open, shape_style.arrowup, color.green, "Buy Signal")
Shape Location
You can use the following enum value items to declare the shape location on the plot:
Enum Item | Purpose |
---|---|
shape_location.abovebar | The shape is located above the bar |
shape_location.belowbar | The shape is located below the bar |
shape_location.bottom | The shape is located near the bottom chart border |
shape_location.top | The shape is located near the top chart border |
shape_location.absolute | The shape position is determined by the series |
Syntax Format
plot_shape(close > open, shape_style.arrowup, shape_location.belowbar, color.green, "Buy Signal")
Shape Size
You can use the following enum value items to declare the shape size on the plot:
Enum Item | Purpose |
---|---|
shape_size.auto | The shape size depends on the bar size |
shape_size.huge | The shape size is constantly huge |
shape_size.large | The shape size is constantly large |
shape_size.normal | The shape size is constantly normal |
shape_size.small | The shape size is constantly small |
shape_size.tiny | The shape size is constantly tiny |
Syntax Format
plot_shape(close > open, shape_style.arrowup, shape_location.belowbar, shape_size.large, color.green, "Buy Signal")
Mobile Platforms Limitations
Certain mobile charts do not support the following shapes, and will display a substitute if such a request is made:
- Circle: substitute – square.
- Diamond: substitute – square.
- Flag: substitute – square.
- Label down: substitute – square.
- Label up: substitute – square.
- Arrow down: substitute – triangle up.
- Arrow up: substitute – triangle up.
- Triangle down: substitute – triangle up.