Skip to content

Building Strategies

Select Build Strategy when you want Xen to create a new automated NinjaTrader 8 Strategy and no existing source file is being modified or converted.

Describe the trading rules from the perspective of behaviour rather than code. Xen needs to know when entries occur, how a position is exited, whether long and short trading are both allowed, and what risk controls are required. Features that are not requested are not added automatically, so include a stop loss, profit target, trailing stop, session filter or position-sizing method only when it belongs in the design.

Generate a baseline

Begin with the smallest version that proves the entry and exit logic. A simple baseline is easier to compile and backtest than a complete system containing every planned feature. If the request is complex, allow the Prompt Builder to create a staged Build Plan.

When the response is complete, Xen presents an overview, one complete C# source file, implementation notes and instructions for using it in NinjaTrader. The action bar at the end of the response can copy the source, download the .cs file, run Build Check or verify the requirements.

Check and compile

Run Build Check before moving the file to NinjaTrader. This checks the source against the NinjaTrader assemblies installed on the Xen server and detects ordinary C# errors as well as selected NinjaScript lifecycle mistakes.

A passed Build Check is not the same as execution inside NinjaTrader. Import or paste the source into the NinjaScript Editor, compile all NinjaScript, and review the NinjaTrader Log for errors raised while the Strategy changes state.

After compilation, use Strategy Analyzer and simulation to confirm that signals, position handling and protective orders behave as intended.

Continue the project

Return to the same conversation for focused refinements. State the required change and avoid asking Xen to redesign working behaviour that should remain intact. Each complete source revision is saved in History when the generated C# changes.

Use Verify requirements after meaningful revisions. It compares the latest source with the explicit requirements from the conversation and separates implemented behaviour, missing behaviour and tests that still require NinjaTrader.

Once Build Check passes, Analyse backtest results changes the workspace to the report-analysis workflow without discarding the project conversation or source.

Simulation before live use

A Strategy can compile successfully and still contain unsuitable order handling, unrealistic assumptions or trading logic that behaves differently in real time. Test with realistic costs and use a simulation account before considering live deployment.