Skip to content

Building Strategies

Select Build Strategy when you want Xen to create a new TradingView strategy and no existing source is being modified or converted. Describe the system as trading behaviour rather than code. Include entry and exit conditions, permitted trade directions, position sizing and any required stop, target, trailing or break-even rules.

Pine strategies also need clear execution assumptions. State whether signals should be confirmed at bar close, whether pyramiding is allowed, how session filters behave and whether higher-timeframe data may be used. Xen does not add unrequested protection automatically, so include every control that belongs in the design.

Build a TradingView strategy with AI

Generate a baseline

Begin with the smallest version that proves the signal and position-management logic. A baseline is easier to compile and backtest than a complete system containing every planned feature. Prompt Builder can create a staged Build Plan when several features interact.

When generation completes, Xen returns one complete Pine Script v6 file with an overview and implementation notes. The response actions copy or download the source, open requirements verification and prepare a Pine error repair. Save the complete file locally as well as in Xen.

Compile and test

Paste the complete script into Pine Editor and click Save. TradingView's compiler is the final authority. Resolve every error and review warnings before adding the strategy to a chart. Then use Strategy Tester to inspect trades and confirm that entries, exits, protective orders, commissions, slippage and date or session controls behave as intended.

Return to the same Xen project for focused refinements. Complete generated revisions are saved in History, and Verify requirements can compare the latest script with the project's explicit requests. Trade-performance analysis remains separate: use Analyse Strategy with a List of Trades CSV when you want Xen to review backtest evidence.

Simulation before live use

A strategy can compile and still contain unsuitable order logic, repainting assumptions or unrealistic historical behaviour. Test on representative symbols and timeframes before considering any live use.