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

Reference

Cheat sheet

One printable page of the Pine you write most often on Tradequix, from the script skeleton to strategies.

View as MarkdownOpen in ClaudeOpen in ChatGPT

Skeleton#

pine
1//@version=62indicator("Name", overlay = true)3len = input.int(20, "Length", minval = 1)4x = ta.ema(close, len)5plot(x, "EMA", color = color.orange)

Series and history#

WriteMeans
close, open, high, low, volumeThis bar's values (volume = tick count)
hl2, hlc3, ohlc4Averages of the above
close[1]Previous bar's close
na(x), nz(x)Test for, or replace, no value
var float x = naKeep x between bars
x := 1Reassign

Studies#

WriteGives
ta.sma/ema/wma/hma(src, len)Averages
ta.rsi(src, len), ta.atr(len)RSI, ATR
[m, u, l] = ta.bb(src, len, 2)Bollinger Bands
[macd, sig, hist] = ta.macd(src, 12, 26, 9)MACD
[st, dir] = ta.supertrend(3, 10)Supertrend (dir < 0 is up)
ta.crossover(a, b)true on the cross bar
ta.highest(high, n), ta.lowest(low, n)Range extremes
ta.valuewhen(cond, src, 0)Value when cond last held

Drawing#

WriteDraws
plot(x, style = plot.style_columns)Line, histogram, columns, area…
plotshape(cond, style = shape.triangleup, location = location.belowbar)Markers where true or non-zero
hline(70)A fixed level
fill(p1, p2, color.new(color.purple, 85))Shade between plots
bgcolor(c), barcolor(c)Tint the background, recolour candles
if barstate.islast + label.new(...)Draw once at the end

Other timeframes#

pine
1htf = request.security(syminfo.tickerid, "60", close[1], lookahead = barmerge.lookahead_on)

Feed timeframes: 5S 10S 15S 30S 1 2 3 5 10 15 30 60 240 D.

Strategy#

pine
1//@version=62strategy("Name", overlay = true, initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 10)3if ta.crossover(ta.ema(close, 9), ta.ema(close, 21))4 strategy.entry("Long", strategy.long)5strategy.exit("Exit", "Long", stop = close * 0.99, limit = close * 1.02)

Limits to remember#

8 s per run · 40 request.* · 3,600 candles per request · 100,000 elements · 50 indicators per chart.

PreviousGlossary

On this page

  • Skeleton
  • Series and history
  • Studies
  • Drawing
  • Other timeframes
  • Strategy
  • Limits to remember

Use with AI

View as MarkdownOpen in ClaudeOpen in ChatGPT