Advanced Features
Multi-timeframe data queries, full session/calendar/barstate/syminfo helpers, hover hit-testing, sub-pane routing, //@strict-no-repaint, and //@js-raw hybrid blocks.
Multi-Timeframe Data (ctx.get_timeframe_data / request.timeframe_data)
Requests and aligns higher-resolution technical indicator series onto the active chart timeframe. In Direct Pine Mode (v1.0.6), use request.timeframe_data(symbol, tf, indName, ...args) or request.security().
const dailyEma = ctx.get_timeframe_data(syminfo.ticker, '1D', 'ema', 200);
Trading Sessions (session.* & ctx.session.in_range)
Validates if a bar falls inside a trading session range. v1.0.6 exposes full Pine session.* booleans alongside ctx.session.in_range:
session.in_range(sessionSpec, tz)&ctx.session.in_range(bar.time, spec)session.ismarket,session.ispremarket,session.ispostmarketsession.regular&session.extended
const nycSession = ctx.session.in_range(bar.time, "0930-1600:23456");
bgcolor(nycSession || session.ismarket ? color.new(color.blue, 90) : na);
Collision, Hover & Mouse State (is_hovered & mouse.*)
Test whether the pointer sits over a chart bar/price bounding region via ctx.is_hovered(barIndex, priceLevel, width, height) or Direct Pine is_hovered(...), and read live pointer coordinates with mouse.x, mouse.y, mouse.is_down, and mouse.clicked.
if (ctx.is_hovered(bar_index, close, 15, 15)) {
// Render interactive tooltips, highlights, or overlays
}
Indicator Panes (ctx.pane & overlay=false)
Setting ctx.pane = 'new' forces the script indicator to render in an isolated horizontal sub-pane below the main chart. In Direct Pine Mode (v1.0.6), clicking Run honors indicator(..., overlay=false) automatically.
ctx.pane = 'new'; // Oscillates on its own chart pane
Alerts & Pine Logs (ctx.alert & log.*)
ctx.alert() triggers toast alerts capped per bar update, while v1.0.6 introduces persistent per-bar telemetry via log.info(), log.warning(), and log.error() with clickable chart bar jump rows.
ctx.alert("Bullish Breakout!", close > resistanceLevel);
ctx.log.info("Breakout close {0}", close);
Calendar, Barstate, Syminfo & Value Helpers
Built-in Pine & transpiler helpers expanded in v1.0.6:
na(val) / nz(val, replacement)
na() tests null/NaN; nz() falls back safely (default 0).
Calendar Helpers (hour, minute, second, dayofmonth, dayofweek, month, year, weekofyear)
Available both as bar series globals and timezone-aware functions alongside timenow, last_bar_index, last_bar_time, and dayofweek.sunday .. dayofweek.saturday.
barstate.* & syminfo.*
Full barstate.{isfirst, islast, ishistory, isrealtime, isnew, isconfirmed, islastconfirmedhistory} and metadata-backed syminfo.{ticker, tickerid, prefix, root, description, currency, basecurrency, timezone, mintick, pointvalue, type}.
//@strict-no-repaint & //@js-raw Escape Hatch (v1.0.6)
Use //@strict-no-repaint to audit MTF lookahead and negative bar offsets with Pine line-mapped gutter diagnostics, or mix low-level HTML5 Canvas 2D inside Pine scripts using //@js-raw ... //@end-js-raw.