Skip to content

Install generated code in NinjaTrader

Xen currently provides complete NinjaScript C# source that you can copy or download as a .cs file. The simplest reliable method is to create the appropriate script inside NinjaTrader and replace its template with the code from Xen.

Install with NinjaScript Editor

Open NinjaTrader and select New → NinjaScript Editor. In the NinjaScript Explorer, locate either Indicators or Strategies, depending on the type of code Xen produced. Right-click the appropriate folder and select New Indicator or New Strategy.

Give the new script exactly the same name as the public class in Xen's code. When the template opens, select all of its contents and replace them with the complete code from Xen. Press F5 to compile.

If NinjaTrader reports an error, copy the complete error message back into the same Xen project. Do not enable a strategy until it compiles cleanly and has been tested in Strategy Analyzer and a simulation account. After an indicator compiles, apply it to a chart and confirm its calculations, plots and settings.

For an existing script, open that script in NinjaScript Editor instead of creating another copy. Replace the editor contents with Xen's complete revised source and compile again.

Install a NinjaScript AddOn

NinjaTrader can also import a valid NinjaScript archive ZIP through Tools → Import → NinjaScript Add-On. This is convenient because NinjaTrader places the packaged source and supporting files in the correct locations.

A normal ZIP containing only a downloaded .cs file is not automatically a valid NinjaScript archive. The package must use NinjaTrader's expected archive structure and metadata. NinjaTrader normally creates this format through Tools → Export → NinjaScript after the script has already been compiled inside NinjaTrader.

Only import archives from a source you trust. Xen currently downloads generated source as a .cs file, so use NinjaScript Editor unless Xen explicitly provides a validated NinjaScript Add-On ZIP.

For NinjaTrader's own archive instructions, see the official NinjaScript import guide and NinjaScript export guide.