Skip to content
TradequixDocsOpen the terminal
OverviewStart here, search, progress
  • Introduction
  • Quickstart
  • How a script runs
  • Types and qualifiers
  • Operators, conditionals and loops
  • Functions and methods
  • Objects and enums
  • Arrays, matrices and maps
  • Strings and colours
  • Time and sessions
  • Bar states
  • Plotting
  • Inputs
  • Technical analysis
  • Drawings and tables
  • Multiple timeframes
  • Strategies
  • Alerts in scripts
  • Repainting
  • The Pine editor
  • Indicator settings
  • Coming from TradingView
  • The data
  • Publish and sell
  • Catalogue and community
  • Your dashboard and earnings
  • Errors and debugging
  • Limits
  • Coverage
  • Built-in catalogue
  • Cookbook
  • Write Pine with AI
  • FAQ
  • Glossary
  • Cheat sheet
  • Function reference
  • Will it run here?
  • Error index
Function reference

Built-ins and plotting

Declarations, plotting, colouring the chart, and the small helpers every script uses: na, nz, fixnan.

54 names from PineTS 0.11.1 · 19 with full entries

indicator

Verified
indicator(title, shorttitle, overlay, format, precision, max_bars_back, max_lines_count, max_labels_count, max_boxes_count)

Declares the script an indicator. Must be the first statement after the version line.

ArgumentTypeMeaning
titleconst stringThe name shown in the legend and the catalogue.
shorttitleoptionalconst stringA shorter name for the legend.
overlayoptionalconst booltrue draws on the price chart; false (default) gives the script its own pane.
precisionoptionalconst intDecimal places for values in the legend.

See alsostrategy

strategy

Verified
strategy(title, shorttitle, overlay, initial_capital, default_qty_type, default_qty_value, pyramiding, commission_type, commission_value, slippage)

Declares the script a strategy, which can place simulated orders and produce a backtest.

ArgumentTypeMeaning
titleconst stringThe strategy's name.
overlayoptionalconst boolDraw on the price chart.
initial_capitaloptionalconst floatStarting equity. Default 1,000,000.
default_qty_typeoptionalconst stringstrategy.fixed, strategy.cash or strategy.percent_of_equity.
default_qty_valueoptionalconst floatThe order size in that unit.
pyramidingoptionalconst intHow many entries may stack in one direction. Default 0.
commission_typeoptionalconst stringstrategy.commission.percent, cash_per_contract or cash_per_order.
commission_valueoptionalconst floatCommission in that unit.
slippageoptionalconst intSlippage in ticks added to market fills.

See alsostrategy.entrystrategy.exit

plot

Verified
plot(series, title, color, linewidth, style, trackprice, histbase, offset, join, editable, show_last, display, force_overlay)

Draws a series on the chart, one value per bar.

ArgumentTypeMeaning
seriesseries int/floatThe values to draw. na leaves a gap.
titleoptionalconst stringName in the legend and settings.
coloroptionalseries colorLine colour; may change per bar.
linewidthoptionalinput intWidth in pixels, 1 to 4.
styleoptionalinput plot_styleplot.style_line, _linebr, _stepline, _histogram, _columns, _area, _areabr, _circles, _cross.
offsetoptionalsimple intShift the plot left (negative) or right by bars.
show_lastoptionalinput intDraw only the last N bars.
displayoptionalinput plot_displaydisplay.none computes without drawing.
force_overlayoptionalconst boolDraw on the price chart from a pane script.

Returns A plot id, for fill().

Runnableplot
1//@version=62indicator("plot", overlay = true)3plot(ta.sma(close, 20), "SMA 20", color = color.orange, linewidth = 2)

See alsofillhlineplotshape

plotshape

Verified
plotshape(series, title, style, location, color, offset, text, textcolor, size, show_last, display, force_overlay)

Draws a shape on bars where the series is true or a non-zero number.

ArgumentTypeMeaning
seriesseries bool/floatWhere to draw. na, false and 0 draw nothing.
styleoptionalinput stringshape.triangleup, triangledown, circle, cross, xcross, diamond, square, flag, arrowup, arrowdown, labelup, labeldown.
locationoptionalinput stringlocation.abovebar, belowbar, top, bottom, absolute.
sizeoptionalconst stringsize.tiny, small, normal, large, huge, auto.
textoptionalconst stringText drawn with the shape.
Runnableplotshape
1//@version=62indicator("plotshape", overlay = true)3plotshape(ta.crossover(ta.ema(close, 9), ta.ema(close, 21)), "Cross", style = shape.triangleup, location = location.belowbar, color = color.teal, size = size.small)

See alsoplotcharplotarrow

plotchar

Verified
plotchar(series, title, char, location, color, offset, text, textcolor, size, show_last, display)

Draws a single character on bars where the series is true or non-zero.

ArgumentTypeMeaning
charinput stringOne character, for example "x" or "▲".

See alsoplotshape

plotarrow

Supported
plotarrow(series, title, colorup, colordown, offset, minheight, maxheight, show_last, display)

Draws an up arrow for positive values and a down arrow for negative ones; zero and na draw nothing.

plotcandle

Verified
plotcandle(open, high, low, close, title, color, wickcolor, bordercolor, display)

Draws candles from your own OHLC series, for example Heikin Ashi computed in the script.

See alsoplotbar

plotbar

Supported
plotbar(open, high, low, close, title, color, display)

Like plotcandle, but draws OHLC bars.

hline

Verified
hline(price, title, color, linestyle, linewidth, editable, display)

A fixed horizontal line at a price or level.

ArgumentTypeMeaning
priceinput int/floatWhere the line sits.
linestyleoptionalinput hline_stylehline.style_solid, style_dotted, style_dashed.

Returns An hline id, for fill().

See alsofill

fill

Verified
fill(plot1, plot2, color, title, editable, fillgaps, display)  ·  fill(hline1, hline2, color, …)

Shades the area between two plots or two hlines.

ArgumentTypeMeaning
plot1, plot2plot or hlineThe ids returned by plot() or hline().
coloroptionalseries colorUsually a transparent colour from color.new().
Runnablefill
1//@version=62indicator("fill", overlay = true)3[m, u, l] = ta.bb(close, 20, 2)4p1 = plot(u, "Upper")5p2 = plot(l, "Lower")6fill(p1, p2, color = color.new(color.purple, 85))

bgcolor

Verified
bgcolor(color, offset, editable, show_last, title, display, force_overlay)

Tints the background behind each bar. na leaves it untouched.

barcolor

Verified
barcolor(color, offset, editable, show_last, title, display)

Recolours the chart's candles.

na

Verified
na(x)  ·  na

As a value, na means "no value". As a function, na(x) is true when x has no value.

See alsonzfixnan

nz

Verified
nz(source, replacement)

Replaces na with a value: 0 by default, or replacement.

Runnablenz
1//@version=62indicator("nz")3change = close - close[1]4plot(nz(change), "Change, na as 0")

fixnan

Supported
fixnan(source)

Replaces na with the last value that was not na.

alert

Verified
alert(message, freq)

Emits an alert event when called. On Tradequix it appears in the editor console.

ArgumentTypeMeaning
freqoptionalinput stringalert.freq_all, freq_once_per_bar, freq_once_per_bar_close.

See alsoalertcondition

alertcondition

Verified
alertcondition(condition, title, message)

Declares a condition that can be alerted on. Captured and shown in the editor console.

timestamp

Supported
timestamp(year, month, day, hour, minute, second)  ·  timestamp(timezone, year, …)

A time in milliseconds, for drawings with xloc.bar_time or comparing with time. The feed runs on UTC.

max_bars_back

Supported
max_bars_back(var, num)

Reserves history for a series that is referenced further back than the engine can infer.

Everything else in Built-ins and plotting

Also implemented. These follow TradingView’s Pine v6 reference for their arguments.

  • bar_indexVerifiedImplemented. Arguments as in TradingView's Pine v6 reference.
  • boolSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • daySupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • dayofmonthSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • dayofweekSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • errorSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • floatVerifiedImplemented. Arguments as in TradingView's Pine v6 reference.
  • freq_allSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • freq_once_per_barSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • freq_once_per_bar_closeSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • hourVerifiedImplemented. Arguments as in TradingView's Pine v6 reference.
  • intVerifiedImplemented. Arguments as in TradingView's Pine v6 reference.
  • linestyle_dashedSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • linestyle_dottedSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • linestyle_solidSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • minuteSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • monthSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • secondSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • stringSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_areaSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_areabrSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_circlesSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_columnsSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_crossSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_dashedSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_dottedSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_histogramSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_lineSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_linebrSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_solidSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_steplineSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_stepline_diamondSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • style_steplinebrSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • weekofyearSupportedImplemented. Arguments as in TradingView's Pine v6 reference.
  • yearVerifiedImplemented. Arguments as in TradingView's Pine v6 reference.

On this page

  • indicator
  • strategy
  • plot
  • plotshape
  • plotchar
  • plotarrow
  • plotcandle
  • plotbar
  • hline
  • fill
  • bgcolor
  • barcolor
  • na
  • nz
  • fixnan
  • alert
  • alertcondition
  • timestamp
  • max_bars_back
  • Everything else (35)