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

Language

Strings and colours

Format numbers for labels and tables, build text, and make colours with transparency and gradients.

View as MarkdownOpen in ClaudeOpen in ChatGPT

Strings#

Strings are text in double or single quotes. Join them with +.

  • str.tostring(x, format.mintick) formats a price to the symbol's precision; "#.00" gives two decimals; format.percent adds a percent sign.
  • str.format("{0} at {1}", "RSI", r) fills placeholders.
  • str.contains, str.replace_all, str.split, str.upper, str.length do what they say.
RunnablePrice tag
1//@version=62indicator("Price tag", overlay = true)3if barstate.islast4 txt = str.format("{0} RSI {1}", str.tostring(close, format.mintick), str.tostring(ta.rsi(close, 14), "#.0"))5 label.new(bar_index, high, txt, style = label.style_label_down, color = color.new(#100e18, 0), textcolor = color.white)

Colours#

  • Named colours: color.teal, color.red, color.orange, color.purple, color.gray and more.
  • Hex: #8b7cff, or with transparency #8b7cff80.
  • color.new(c, transp) sets transparency from 0 (solid) to 100 (invisible).
  • color.rgb(r, g, b, transp) builds one from channels.
  • color.from_gradient(value, lo, hi, loColor, hiColor) blends by where a value sits.
RunnableGradient RSI
1//@version=62indicator("Gradient RSI")3r = ta.rsi(close, 14)4plot(r, "RSI", color = color.from_gradient(r, 30, 70, color.red, color.teal), linewidth = 3)5hline(70)6hline(30)

A colour can change per bar: pass a series (often a ternary) wherever a color is accepted.

PreviousArrays, matrices and mapsNext Time and sessions

On this page

  • Strings
  • Colours

Use with AI

View as MarkdownOpen in ClaudeOpen in ChatGPT