Skip to content

Use Generated Code in TradingView

Xen returns one editable Pine Script v6 file. The action bar beneath complete code can copy the source, download a .pine file, verify the requirements or open the Pine error repair workflow.

Open a TradingView chart and launch Pine Editor. Create a new script or open the script being replaced, select the full editor contents and paste the complete Xen response. Confirm that the file contains one indicator(), strategy() or library() declaration and that its //@version=6 directive appears at the top. Click Save and resolve every Pine Editor error before selecting Add to chart.

TradingView may report warnings even when compilation succeeds. Read them carefully. Warnings about history-dependent functions running conditionally, lookahead settings or unconfirmed data can indicate inconsistent or repainting behaviour. Use Fix Pine Errors with the exact warning and complete source when a repair is needed.

Test before relying on the script

For indicators, compare plots, values and alerts across several symbols and timeframes. Check historical and real-time bars, the first available bars, higher-timeframe requests and any behaviour that can repaint.

For strategies, open Strategy Tester and inspect individual trades as well as summary statistics. Confirm entries, exits, position sizing, pyramiding, protective orders, commission, slippage and session behaviour. TradingView's broker emulator is a simulation, so historical performance and order fills do not guarantee future results.

Keep a local copy of every version that has been compiled and tested. Xen History is useful for restoring generated snapshots, but it should not be the only backup for important source.