API Reference

Complete function reference for PineTS in TradingGoose

Complete reference of all supported PineTS functions in TradingGoose, organized by namespace. This page is derived from the PineTS runtime type definitions.

input (13 functions)

FunctionReturnsDescription
input.int(defval, title, min?, max?, step?)numberInteger input
input.float(defval, title, min?, max?, step?)numberFloat input
input.bool(defval, title)booleanBoolean input
input.string(defval, title)stringString input
input.color(defval, title)stringColor picker
input.source(defval, title)seriesData source selector
input.timeframe(defval, title)stringTimeframe selector
input.price(defval, title)numberPrice input
input.time(defval, title)numberTimestamp input
input.session(defval, title)stringSession input
input.symbol(defval, title)stringSymbol input
input.text_area(defval, title)stringMulti-line text
input.enum(defval, title, options)TDropdown selector

ta (57 functions)

Moving Averages

FunctionDescription
ta.alma(source, length, offset?, sigma?)Arnaud Legoux MA
ta.ema(source, length)Exponential MA
ta.hma(source, length)Hull MA
ta.linreg(source, length, offset?)Linear Regression
ta.rma(source, length)Rolling MA
ta.sma(source, length)Simple MA
ta.swma(source)Symmetrically Weighted MA
ta.vwap / ta.vwap(source)Volume Weighted Average Price
ta.vwma(source, length)Volume Weighted MA
ta.wma(source, length)Weighted MA

Oscillators

FunctionDescription
ta.cci(source, length)Commodity Channel Index
ta.change(source, length?)Price Change
ta.cmo(source, length)Chande Momentum Oscillator
ta.cog(source, length)Center of Gravity
ta.macd(source, fast, slow, signal)MACD → [macd, signal, hist]
ta.mfi(series, length)Money Flow Index
ta.mom(source, length)Momentum
ta.roc(source, length)Rate of Change
ta.rsi(source, length)Relative Strength Index
ta.stoch(source, high, low, length)Stochastic
ta.tsi(source, short, long)True Strength Index
ta.wpr(length)Williams %R

Volatility

FunctionDescription
ta.atr(length)Average True Range
ta.bb(source, length, mult)Bollinger Bands → [mid, upper, lower]
ta.bbw(source, length, mult)Bollinger Bands Width
ta.dev(source, length)Mean Absolute Deviation
ta.kc(source, length, mult)Keltner Channels → [mid, upper, lower]
ta.kcw(source, length, mult)Keltner Channels Width
ta.range(source, length)Range
ta.stdev(source, length)Standard Deviation
ta.tr / ta.tr(handleNa?)True Range
ta.variance(source, length)Variance

Volume (variables)

VariableDescription
ta.accdistAccumulation/Distribution
ta.iiiIntraday Intensity Index
ta.nviNegative Volume Index
ta.obvOn-Balance Volume
ta.pviPositive Volume Index
ta.pvtPrice-Volume Trend
ta.wadWilliams A/D
ta.wvadWilliams Variable A/D

Trend

FunctionDescription
ta.cross(a, b)Cross (either direction)
ta.crossover(a, b)Cross above
ta.crossunder(a, b)Cross below
ta.dmi(diLength, adxSmoothing)DMI → [plus, minus, adx]
ta.falling(source, length)Falling detection
ta.rising(source, length)Rising detection
ta.sar(start, inc, max)Parabolic SAR
ta.supertrend(factor, atrLength)SuperTrend → [value, direction]

Statistics

FunctionDescription
ta.barssince(condition)Bars since condition
ta.correlation(a, b, length)Correlation coefficient
ta.cum(source)Cumulative sum
ta.highest(source, length)Highest over N bars
ta.highestbars(source, length)Bars since highest
ta.lowest(source, length)Lowest over N bars
ta.lowestbars(source, length)Bars since lowest
ta.max(a, b)Maximum
ta.median(source, length)Median
ta.min(a, b)Minimum
ta.mode(source, length)Mode
ta.percentile_linear_interpolation(source, len, pct)Percentile (linear)
ta.percentile_nearest_rank(source, len, pct)Percentile (nearest rank)
ta.percentrank(source, length)Percentile rank
ta.pivot_point_levels(type, anchor)Pivot point levels
ta.pivothigh(source, left, right)Pivot high
ta.pivotlow(source, left, right)Pivot low
ta.rci(source, length)Rank Correlation Index
ta.valuewhen(condition, source, occurrence)Value when condition

math (28 functions + 4 constants)

Function / ConstantDescription
math.pi, math.e, math.phi, math.rphiMathematical constants
math.abs(x)Absolute value
math.ceil(x)Round up
math.floor(x)Round down
math.round(x, precision?)Round
math.round_to_mintick(x)Round to min tick
math.sign(x)Sign
math.max(a, b)Maximum
math.min(a, b)Minimum
math.avg(...)Average
math.sum(source, length)Sum
math.pow(base, exp)Power
math.sqrt(x)Square root
math.exp(x)Exponential
math.log(x)Natural log
math.log10(x)Base-10 log
math.sin(x), math.cos(x), math.tan(x)Trigonometric
math.asin(x), math.acos(x), math.atan(x)Inverse trig
math.todegrees(x), math.toradians(x)Angle conversion
math.random(min?, max?)Random number

plot (10 functions)

FunctionDescription
plot(series, title?, options?)Line/area/histogram plot
plotshape(series, title?, options?)Shape markers
plotchar(series, title?, char?, options?)Character markers
plotarrow(series, title?, options?)Arrow markers
plotbar(o, h, l, c, title?, options?)OHLC bars
plotcandle(o, h, l, c, title?, options?)Candlesticks
hline(price, title?, options?)Horizontal line
fill(plot1, plot2, color?)Fill between plots
bgcolor(color, offset?, options?)Background color
barcolor(color, offset?, options?)Bar color

array (52 methods)

CategoryFunctions
Createfrom, new_float, new_int, new_bool, new_string, copy
Accessget, set, first, last
Modifypush, pop, shift, unshift, insert, remove, clear, fill, reverse
Shapesize, slice, concat
Searchindexof, lastindexof, includes, binary_search, binary_search_leftmost, binary_search_rightmost, every, some
Sortsort, sort_indices
Statssum, avg, min, max, median, mode, stdev, variance, covariance, range, percentrank, percentile_linear_interpolation, percentile_nearest_rank
Transformabs, join, standardize

map (11 methods)

new, get, put, put_all, contains, remove, keys, values, size, clear, copy

matrix (50 methods)

CategoryFunctions
Accessget, set, row, col
Sizerows, columns, elements_count, reshape, submatrix
Modifyadd_row, add_col, remove_row, remove_col, swap_rows, swap_columns, fill, reverse, concat, copy
Arithmeticmult, pow, diff, kron
Linear Algebradet, inv, pinv, eigenvalues, eigenvectors, rank, trace, transpose
Statssum, avg, min, max, median, mode, stdev, variance
Booleanis_square, is_identity, is_diagonal, is_antidiagonal, is_triangular, is_symmetric, is_antisymmetric, is_stochastic, is_binary, is_zero
Sortsort

str (19 methods)

length, contains, startswith, endswith, pos, match, substring, split, replace, replace_all, lower, upper, trim, repeat, format, tonumber, tostring

log (3 methods)

log.info(msg), log.warning(msg), log.error(msg)

request (2 functions)

FunctionDescription
request.security(symbol, timeframe, expression)Multi-timeframe data
request.security_lower_tf(expression)Lower timeframe data

trigger (TradingGoose extension)

trigger(event: string, options: { condition, input, signal, position?, color? })

See Indicator Triggers for full documentation.

This reference covers functions available in TradingGoose's PineTS runtime. PineTS is based on the open-source PineTS project and supports a subset of Pine Script v5/v6 APIs. Features like strategy.*, label.*, line.*, box.*, and table.* are not currently supported.