TradingView logo

The TradingView Pine programming reference gives an overview of all code elements around a certain topic. They contain brief examples, helpful notes and tips, and are a quick lookup for when you’re coding.

Besides the reference articles below, there are also TradingView programming articles and TradingView coding recipes for additional information.

TradingView Pine programming

Text

icon In this category we look at the different ways to work with a string of text in TradingView Pine. So far, the function listed below is the only code element we have for that.

Code element Description
tostring() Converts a numerical value to a string of text optionally based on a certain output format.

Back to table of contents ↑

Alerts

icon In this category we look at using alerts in TradingView Pine. The one code element listed below makes it possible to create alert conditions in indicator scripts.

Code element Description
alertcondition() Creates an alert condition that we can enable in the ‘Create Alert’ window after adding the indicator to the chart.

Back to table of contents ↑

Colours in TradingView

Colours

icon In this category we explore the different colour options in TradingView Pine. For each colour element we’ll also explore how we can expand on it with things like conditional colours and transparency effects.

Code element Description
#* Specifies a colour in hexadecimal format for use with plotting and drawing functions.
aqua Returns the aqua colour for use with plotting and drawing functions.
black Returns the colour black for use with plotting and drawing functions.
blue Returns the colour blue for use with plotting and drawing functions.
color() Makes a colour value transparent for use with plotting and drawing functions.
fuchsia Returns the fuchsia colour for use with plotting and drawing functions.
gray Returns the colour grey for use with plotting and drawing functions.
green Returns the colour green for use with plotting and drawing functions.
lime Returns the colour lime for use with plotting and drawing functions.
maroon Returns the maroon colour for use with plotting and drawing functions.
navy Returns the navy blue colour for use with plotting and drawing functions.
olive Returns the colour olive green for use with plotting and drawing functions.
orange Returns the colour orange for use with plotting and drawing functions.
purple Returns the colour purple for use with plotting and drawing functions.
red Returns the colour red for use with plotting and drawing functions.
silver Returns the colour silver for use with plotting and drawing functions.
teal Returns the colour teal for use with plotting and drawing functions.
white Returns the colour white for plotting and drawing functions.
yellow Returns the colour yellow for use with plotting and drawing functions.

Back to table of contents ↑

Environment

Chart information

icon The different variables below return information about the chart’s time frame that our indicator or strategy currently calculates on. With them, we can figure out the period interval of price bars.

Code element Description
interval Returns the time frame’s resolution of the chart that the script calculates on.
isdaily Indicates whether the script calculates on a daily chart resolution.
isdwm Indicates whether the script calculates on a daily, weekly, or monthly time frame.
isintraday Indicates whether the script calculates on an intra-day chart resolution.
ismonthly Indicates whether the script calculates on a monthly chart resolution.
isweekly Indicates whether the script calculates on a weekly chart resolution.
period Returns the time frame (resolution + type) of the chart that the script calculates on.

Back to table of contents ↑

Symbol information

icon The variables listed below return various pieces of information about the symbol on which our indicator or strategy calculates. With them we get our instrument’s root symbol, fetch the exchange name, and calculate how much one tick of price movement is worth.

Code element Description
syminfo.mintick Returns the minimum tick value of the symbol that the script calculates on.
syminfo.pointvalue Returns the currency point value of the symbol that the script calculates on.
syminfo.prefix Returns the exchange prefix for the instrument that the script calculates on.
syminfo.root Returns the symbol root when the script calculates on a derivative. Otherwise returns the instrument’s regular symbol.
syminfo.session Returns the session type (regular or extended) of the instrument that the script calculates on.
syminfo.timezone Returns the exchange time zone for the instrument that the script calculates on.
ticker Returns the symbol for the instrument that the script currently calculates on.
tickerid Returns the symbol with exchange prefix for the instrument that the script calculates on.

Back to table of contents ↑

Alphabetical reference

Symbols

Code element Description
#* Specifies a colour in hexadecimal format for use with plotting and drawing functions.

Back to table of contents ↑

A

Code element Description
alertcondition() Creates an alert condition that we can enable in the ‘Create Alert’ window after adding the indicator to the chart.
aqua Returns the aqua colour for use with plotting and drawing functions.

Back to table of contents ↑

B

Code element Description
black Returns the colour black for use with plotting and drawing functions.
blue Returns the colour blue for use with plotting and drawing functions.

Back to table of contents ↑

C

Code element Description
color() Makes a colour value transparent for use with plotting and drawing functions.

Back to table of contents ↑

D

Back to table of contents ↑

E

Back to table of contents ↑

F

Code element Description
fuchsia Returns the fuchsia colour for use with plotting and drawing functions.

Back to table of contents ↑

G

Code element Description
gray Returns the colour grey for use with plotting and drawing functions.
green Returns the colour green for use with plotting and drawing functions.

Back to table of contents ↑

H

Back to table of contents ↑

I

Code element Description
interval Returns the time frame’s resolution of the chart that the script calculates on.
isdaily Indicates whether the script calculates on a daily chart resolution.
isdwm Indicates whether the script calculates on a daily, weekly, or monthly time frame.
isintraday Indicates whether the script calculates on an intra-day chart resolution.
ismonthly Indicates whether the script calculates on a monthly chart resolution.
isweekly Indicates whether the script calculates on a weekly chart resolution.

Back to table of contents ↑

J

Back to table of contents ↑

K

Back to table of contents ↑

L

Code element Description
lime Returns the colour lime for use with plotting and drawing functions.

Back to table of contents ↑

M

Code element Description
maroon Returns the maroon colour for use with plotting and drawing functions.

Back to table of contents ↑

N

Code element Description
navy Returns the navy blue colour for use with plotting and drawing functions.

Back to table of contents ↑

O

Code element Description
olive Returns the colour olive green for use with plotting and drawing functions.
orange Returns the colour orange for use with plotting and drawing functions.

Back to table of contents ↑

P

Code element Description
period Returns the time frame (resolution + type) of the chart that the script calculates on.
purple Returns the colour purple for use with plotting and drawing functions.

Back to table of contents ↑

Q

Back to table of contents ↑

R

Code element Description
red Returns the colour red for use with plotting and drawing functions.

Back to table of contents ↑

S

Code element Description
silver Returns the colour silver for use with plotting and drawing functions.
syminfo.mintick Returns the minimum tick value of the symbol that the script calculates on.
syminfo.pointvalue Returns the currency point value of the symbol that the script calculates on.
syminfo.prefix Returns the exchange prefix for the instrument that the script calculates on.
syminfo.root Returns the symbol root when the script calculates on a derivative. Otherwise returns the instrument’s regular symbol.
syminfo.session Returns the session type (regular or extended) of the instrument that the script calculates on.
syminfo.timezone Returns the exchange time zone for the instrument that the script calculates on.

Back to table of contents ↑

T

Code element Description
teal Returns the colour teal for use with plotting and drawing functions.
ticker Returns the symbol for the instrument that the script currently calculates on.
tickerid Returns the symbol with exchange prefix for the instrument that the script calculates on.
tostring() Converts a numerical value to a string of text optionally based on a certain output format.

Back to table of contents ↑

U

Back to table of contents ↑

V

Back to table of contents ↑

W

Code element Description
white Returns the colour white for plotting and drawing functions.

Back to table of contents ↑

X

Back to table of contents ↑

Y

Code element Description
yellow Returns the colour yellow for use with plotting and drawing functions.

Back to table of contents ↑

Z

Back to table of contents ↑

Popular reference articles

icon The most popular TradingView reference articles of the last 90 days are:

  1. alertcondition() - TradingView | TradingCode.net
  2. tostring() - TradingView | TradingCode.net
  3. period - TradingView | TradingCode.net
  4. interval - TradingView | TradingCode.net
  5. tickerid - TradingView | TradingCode.net
  6. syminfo.mintick - TradingView | TradingCode.net
  7. ticker - TradingView | TradingCode.net
  8. syminfo.pointvalue - TradingView | TradingCode.net
  9. isintraday - TradingView | TradingCode.net
  10. black - TradingView | TradingCode.net
  11. color() - TradingView | TradingCode.net
  12. syminfo.prefix - TradingView | TradingCode.net
  13. syminfo.root - TradingView | TradingCode.net
  14. green - TradingView | TradingCode.net
  15. blue - TradingView | TradingCode.net

Back to table of contents ↑