Skip to content
Back to App

Pine Script

TestMax runs supported Pine Script v5 and v6 indicators and strategies on replay charts. Paste a script, apply it to the available chart history, and follow its plots and simulated trades as the replay advances.

What you can do

  • Create custom indicators. Draw overlays, separate indicator panes, shapes, characters, arrows, colored candles, fills, drawing objects, and tables.
  • Test strategy rules. Simulate entries, partial exits, trailing stops, order groups, FIFO or named-entry closes, margin requirements, and liquidation. Review the equity curve and trade log in the Strategy Tester.
  • Reuse saved libraries. Save available library source under its import path and import its exported functions and types into another script.
  • Use other available chart contexts. Supported request.security() and request.security_lower_tf() calls use data available in the replay and compatible additional chart panes.
  • Work with large documents. Paste, import, edit, save, and export UTF-8 scripts up to 50 MiB. Comment-heavy 30 MiB documents can compile when their executable code stays within the workload limits.

Support covers a growing part of Pine, including common charting and strategy workflows. It does not promise complete TradingView compatibility or identical results. Check Supported Features for the functions, data requirements, and rendering limits that apply to your script.

Indicators, strategies, and libraries

Script kindDeclarationUse
Indicatorindicator()Calculate values and display them on a chart or separate pane
Strategystrategy()Add simulated orders, chart trade markers, and Strategy Tester results
Librarylibrary()Save reusable exports that an indicator or strategy imports

Libraries are saved rather than applied directly to a chart. The editor detects the declaration and changes its action to Save library.

Applied scripts have legend controls for visibility, inputs, and removal. Saved source is stored in your account, while applied scripts and their input values restore for the relevant symbol.

Working with TradingView scripts

Start with the original source and the same intended symbol, timeframe, and inputs. Add any required library source and chart panes before applying it. Review a few known signals, drawings, and trades before relying on a long run.

Data coverage, exchange sessions, available history, and broker assumptions can change results. Unsupported features report errors where recognized. For example, a request for unavailable data needs another chart dataset, while Bar Magnifier and alternate strategy calculation modes are not implemented.

See Strategies for order timing, margin defaults, FIFO behavior, and how forming candles affect provisional results.

Where scripts run

Compilation and calculations run in a worker in your browser. Saving a script stores its source on your account; the backend does not execute that source. Long-running calculations and excessive output stop with an error.

Large documents use a plain-text editor mode. Their file size and the amount of executable work are separate limits: a long comment can be inexpensive to calculate, while a short script with large loops can exceed the runtime budget.

Pine Script and the Algo Playground

Pine ScriptAlgo Playground
LanguagePine v5/v6Python
ExecutionBrowser workerTestMax server
WorkspaceReplay chart and Strategy TesterDedicated configuration and results page
Typical useCustom chart visuals and strategy checks during replayAlgorithms using the Simulator API

Next steps