Build once, then run any example with Node or Bun:
npm ci && npm run build
node examples/candles.js
bun examples/candles.js # Bun loads .env automatically
node --env-file=.env examples/indicator-data.js # Examples that need an accountExamples that need an account read the SESSION and SIGNATURE cookies from the environment (see .env.sample). Never commit them.
| Example | API | Account |
|---|---|---|
| candles.js | getCandles (count, from/to) |
No |
| watch-candles.js | watchCandles |
No |
| quotes.js | getQuote, getQuotes, watchQuotes |
No |
| indicator-data.js | getIndicatorData |
Pine scripts only |
| screener.js | getScreener (filters, columns, ranking) |
No |
| search.js | searchMarkets, searchIndicators, getTechnicalAnalysis |
No |
| custom-chart-types.js | Heikin Ashi, Renko, Line Break, Kagi, P&F, Range | No (daily) |
| errors.js | TradingViewError codes |
Partly |
| simple-chart.js | TradingViewClient, ChartSession |
No |
| quote-session.js | QuoteSession |
No |
| builtin-indicator.js | BuiltInIndicator, study graphics |
No |
| fake-replay.js | Negative counts and fetchMore |
No |
| strategy-report.js | Public strategy → trade records → closed/open PnL summary | Yes (Basic tested) |
| replay.js | Replay mode with studies | Pine studies only |
| custom-timeframe.js | Second-based timeframes | Yes |
| from-to.js | Reference times and ranges | Yes |
| graphic-indicator.js | Labels, lines, boxes, tables | Yes |
| multiple-indicators.js | Shared connection | Yes |
| private-indicators.js | getPrivateIndicators |
Yes |
| drawings.js | getDrawings |
Private layouts |
| pine-permissions.js | PinePermissionManager |
Yes (script owner) |
| user-login.js | loginUser, getUser |
Username/password |