Few more examples of predefined functions in Pine Script that can be used for various purposes:
Charting Functions:
plot(data, style=plot.style_line, title="", color=color.black, linewidth=1)
: plots the data
on the chart with specified style
, title
, color
, and linewidth
.hline(level, title="", color=color.black, linewidth=1)
: plots a horizontal line at the specified level
with a specified title
, color
, and linewidth
.vline(bar_index, title="", color=color.black, linewidth=1)
: plots a vertical line at the specified bar_index
with a specified title
, color
, and linewidth
.fill(data1, data2, color=color.black, transp=80)
: fills the area between data1
and data2
with a specified color
and transparency
.label(text, x=bar_index, y=close, color=color.black, style=label.style_none)
: adds a label with specified text
, x
and y
position, color
, and style
to the chart.shapes(shape_type, x1, y1, x2, y2, color=color.black, transp=80, text="")
: plots a shape of specified shape_type
with the specified x1
, y1
, x2
, y2
coordinates, color
, transparency
and text
on the chart.Other useful functions
strategy.position_size
: returns the current position size of the strategystrategy.risk
: returns the current risk of the strategystrategy.equity
: returns the current equity of the strategystrategy.profit
: returns the current profit of the strategystrategy.order
: returns the current order of the strategyThese are just a few examples of the many predefined functions available in Pine Script. Pine Script is a powerful and versatile language, and it is continually being updated with new features and functions by the community. It's always a good idea to check the Pine Script documentation for the latest list of available functions and their usage.
Get full access to all training courses.