Skip to main content

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

ParameterTypePurposeDefault State
series series. The values are treated as boolean, if the plot_shape_style is not shape_location.absoluteInput series-
namestringThe plot nameseries.name
plot_shape_styleshape_styleThe style of the shapeshape_style.xcross
plot_shape_size shape_sizeThe size of the shapeshape_size.auto
shape_colorcolorThe color of the shape"white"
plot_shape_locationshape_locationThe location of the shapeshape_location.abovebar
offsetintegerThe offset in bars to shift the shape left or right0
text stringThe text to display""
text_colorcolorThe 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 ItemPurposeResult
shape_style.arrowdown Arrow down shapearrowdown
shape_style.arrowup Arrow up shapearrowup
shape_style.circle Circle shapecircle
shape_style.cross Cross shapecross
shape_style.diamond Diamond shapediamond
shape_style.flag Flag shapeflag
shape_style.labeldown Label down shapelabeldown
shape_style.labelupLabel up shapelabelup
shape_style.square Square shapesquare
shape_style.triangledown Triangle down shapetriangledown
shape_style.triangleup Triangle up shapetriangleup
shape_style.xcross X Cross shapexcross

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 ItemPurpose
shape_location.abovebar The shape is located above the bar
shape_location.belowbar The shape is located below the bar
shape_location.bottomThe shape is located near the bottom chart border
shape_location.topThe 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 ItemPurpose
shape_size.auto The shape size depends on the bar size
shape_size.hugeThe shape size is constantly huge
shape_size.largeThe shape size is constantly large
shape_size.normalThe shape size is constantly normal
shape_size.smallThe shape size is constantly small
shape_size.tinyThe 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.