1. Home
  2. Docs
  3. DLPAL S
  4. NinjaTrader code generation

NinjaTrader code generation

From the search or system tracking results select the strategies for code generation and click NinjaTrader Code.

An example of code generation for a single strategy is shown below

The generated code may be saved by clicking on File and then Save.

In the case of strategies with a delay in trade input, all bars in the code are shifted according to the delay value. Therefore, the delay is already accounted for.

Raw Code

Click on “Raw Code” from search results to generate raw code for selected strategies:

Raw code for selected strategies may be displayed on the screen by clicking on “Raw Code”. You may copy and paste the raw code in a line editor for further manipulation. Raw code is also generated automatically and saved in two text files. Each line in the files contains the following:

Strategy Code;File;Type;TradeOn,Target;Stop;C

where File is the filename, Type is LONG OR SHORT, TradeOn is Open or Close, Target is the profit target, stop is the stop-loss and C is % or pts. Strategy Code is the formula code used by the native language of the various supported platforms.

The raw code generation applies only to the Search and Database results. Two files with identical content are saved automatically in sub-directory Results:

(1) A file called GeneratedCode.txt which is overwritten every time new code is generated.

(2) A file with the name: RawCode_mm_dd_yyyy_hh_mm.txt

This file is overwritten only if new code generation takes place during the same minute mm that the file was initially generated.

The text files containing raw code can be deleted using a new tool added to File Maintenance under Results and called “Code .TXT FILES”.

System Code

Click on “System Code” from search results to generate system code for selected strategies.

blank

Note: System code can be generated only when there is one symbol (data file) in results and with strategies that have the same exit parameters. If there several symbols, results for each can be saved in a different results file to be used for code generation.