Exciting Update: Version 1.0.6 is now available, introducing Direct Pine Script Mode, Pine Logs Runtime Bridge, Zero-Repaint Linting, Source Maps, Intrabar MFE/MAE Stats, and expanded Pine v5/v6 Transpiler Parity. Read more
Version: 1.0.6

Data Feeds & Bounds

Documenting raw market feeds, canvas boundaries, mouse variables, built-in Pine price & calendar series, syminfo / barstate / session metadata, and ctx.log telemetry.

ctx.bars

An array of objects representing the historical market price feed loaded on the chart.

BacktestX Script
{
  open: 101.25,   // Open price
  high: 103.50,   // High price
  low: 99.80,     // Low price
  close: 102.10,   // Close price
  volume: 240500,   // volume units
  time: 1784931200 // Unix epoch in milliseconds
}

ctx.bounds

An object describing viewport boundaries and sizing metrics for the active price chart pane:

BacktestX Script
{
  chartW: 960,       // Pixel width of drawing area
  chartH: 480,       // Pixel height of drawing area
  startIndex: 45,    // Leftmost visible bar index
  endIndex: 125,     // Rightmost visible bar index
  numVisible: 80,    // Total visible bars
  candleSlot: 8,     // Width of each candle slot
  xOffset: 0         // Scroll offset in pixels
}

ctx.mouse

Real-time coordinates and action state of the mouse cursor over the canvas (also available in Direct Pine Mode as mouse.x, mouse.y, mouse.is_down, and mouse.clicked):

BacktestX Script
{
  x: 242.5,     // Pixel X relative to canvas
  y: 150.0,     // Pixel Y relative to canvas
  isDown: false, // Left mouse button is down
  clicked: false // Click action occurred
}

ctx.drawings

An array of active drawing tools placed on the chart.

BacktestX Script
// Shape of entries:
{
  id: "line_1",
  type: "trend_line",
  points: [ { barIndex: 50, price: 105.0 } ],
  style: { color: '#ff0000', width: 2 },
  locked: false
}

ctx.indicators

An array representing all standard active indicators configured on the chart.

BacktestX Script
{
  type: "rsi",
  params: { period: 14 },
  color: "#9c27b0",
  enabled: true,
  values: [ /* calculated numerical values */ ]
}

ctx.customScripts

Array of all loaded custom scripts. As of v1.0.6, entries preserve editable sourceCode, lang, langMode, and pane placement (overlay=false allocates a sub-pane):

BacktestX Script
{
  id: "script_0",
  name: "EMA Cross Over",
  code: "// compiled JS code",
  sourceCode: "//@version=5...",
  lang: "pine",
  langMode: "auto",
  enabled: true
}

Built-in Price & Calendar Series (v1.0.6)

Direct Pine Mode exposes derived price series, bar-count bounds, and UTC/chart calendar components natively on every bar:

  • Derived Prices: hl2 (high + low)/2, hlc3 (high + low + close)/3, ohlc4, and hlcc4 (high + low + 2*close)/4.
  • Dataset Endpoints: last_bar_index, last_bar_time, and wall-clock timenow.
  • Calendar Variables & Functions: year, month, weekofyear, dayofmonth, dayofweek (plus constants dayofweek.sunday .. dayofweek.saturday), hour, minute, and second.

syminfo, barstate & session (v1.0.6)

Metadata-backed globals replace hardcoded placeholders so scripts adapt cleanly to any market or session:

  • syminfo.*: ticker, tickerid, prefix, root, description, currency, basecurrency, timezone, mintick, pointvalue, and type read live chart instrument metadata.
  • barstate.*: isfirst, islast, ishistory, isrealtime, isnew, isconfirmed, and islastconfirmedhistory.
  • session.*: session.in_range(sessionSpec, tz) (wired to ctx.session.in_range), plus session.ismarket, session.ispremarket, session.ispostmarket, session.regular, and session.extended.

ctx.log & is_hovered() (v1.0.6)

Scripts can stream structured per-bar telemetry and react directly to cursor proximity on canvas:

  • ctx.log / Pine log.*: Exposes info(), warn() / log.warning(), and error() with {0} formatting, storing up to MAX_SCRIPT_LOGS = 500 entries synced via cl:script-logs. See Pine Logs Telemetry.
  • Hover Hit-Testing: ctx.isHovered(...) and Pine is_hovered(barIndex, priceLevel, width, height) test if the cursor is over a price coordinate without manual geometry math.