Every built-in, with syntax, arguments and scripts you can run.
Write Pine Script on any Sidechair chart. Look anything up here.
Start here
- Getting started
- Write a script, see it on a live chart, keep it in your account.
- Porting from TradingView
- Most version 5 and 6 indicators run as written. Paste, compile, add to chart.
Browse the reference
Functions472 functionsVariables163 variablesConstants34 constant groupsTypes20 typesKeywords23 keywordsOperators21 operatorsAnnotations10 annotations
Most used
The built-ins public scripts reach for most.
- close
- The closing price of the current bar; on a bar that is still forming, the latest traded price.
- plot()
- Draws a series on the chart as a line, histogram, columns, area, circles or steps, and returns a plot handle that fill can use.
- color()
- Converts a value to the color type; color(na) gives a na that is typed as a colour.
- input()
- Adds a setting to the script and returns its value; the setting's type follows the type of the default.
- na
- The value that means no value; assigning it clears a variable and any calculation using it returns na.
- na()
- Tests a value for na and returns true when it is missing, the only reliable way to check.
- input.int()
- Adds an integer setting to the script, optionally limited by minimum, maximum and step or chosen from a list.
- float()
- Converts a value to a float; float(na) gives a na that is typed as a float.
- indicator()
- Declares the script as an indicator and sets its title, pane placement, display format and drawing limits.
- int()
- Converts a number to an int by dropping the fraction, and keeps na as na.
- color.new()
- Returns a color with the same red, green and blue as the one you pass but a new transparency.
- high
- The highest price traded during the current bar.
- low
- The lowest price traded during the current bar.
- input.float()
- Adds a decimal-number setting to the script, optionally limited by minimum, maximum and step or chosen from a list.
- bar_index
- The number of the current bar, counting from 0 at the first bar loaded on the chart.
- input.bool()
- Adds a checkbox setting to the script and returns true or false.
- strategy.entry()
- Places an order to open or add to a position; an opposite entry reverses the position.
- ta.sma()
- Returns the simple moving average: the plain mean of the last length values of source, na until length bars exist.
- math.max()
- Returns the largest of the numbers you pass; na if any of them is na.
- bool()
- Converts a number to true or false: 0 and na give false, everything else gives true.
- ta.ema()
- Returns the exponential moving average of source over length bars, weighting recent values by a smoothing factor of 2 / (length + 1).
- str.tostring()
- Converts a number, boolean, string or array to text, optionally through a format pattern or a format.* constant.
- bgcolor()
- Colors the background behind a bar, evaluated per bar, with transparency to keep the price visible.
- time
- The opening time of the current bar as a UNIX timestamp in milliseconds.