
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 thedata
on the chart with specifiedstyle
,title
,color
, andlinewidth
.hline(level, title="", color=color.black, linewidth=1)
: plots a horizontal line at the specifiedlevel
with a specifiedtitle
,color
, andlinewidth
.vline(bar_index, title="", color=color.black, linewidth=1)
: plots a vertical line at the specifiedbar_index
with a specifiedtitle
,color
, andlinewidth
.fill(data1, data2, color=color.black, transp=80)
: fills the area betweendata1
anddata2
with a specifiedcolor
andtransparency
.label(text, x=bar_index, y=close, color=color.black, style=label.style_none)
: adds a label with specifiedtext
,x
andy
position,color
, andstyle
to the chart.shapes(shape_type, x1, y1, x2, y2, color=color.black, transp=80, text="")
: plots a shape of specifiedshape_type
with the specifiedx1
,y1
,x2
,y2
coordinates,color
,transparency
andtext
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 strategy
These 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.