NinjaScript > Distribution >

Export

Print this Topic Previous pageReturn to chapter overviewNext page

You can export NinjaScript indicators and strategies for others to import in several formats:
 

Source files - NinjaScript indicator and strategy source files that can be imported and edited by others
Assemblies - A compiled assembly (DLL) of NinjaScript indicators and strategies that "hides" your source code. This can be further protected by SecureTeam's CliSecure to prevent theft of your intellectual property.
tog_minusExporting NinjaScript Indicators or Strategies as Source Files

You may want to provide other NinjaTrader users with source files of your NinjaScript indicators or strategies in a format where they are able to view and edit them.

 

1.From the Control Center window select the menu File > Utilities > Export NinjaScript to open the "Export NinjaScript" dialog window

 

2.Select the option "Export selected source files"

 

3.Enter a user defined file name

 

4.Select all of the files that you want to export and either double click on them or press the ">" button

 

5.A list of all files that will be exported

 

6.Press the "Export" button to export the selected files

 

7.A NinjaScript Archive File (.zip) file will be created in My Documents\<NinjaTrader Folder>\bin\Custom\ExportNinjaScript

 

8.The file can be imported by another NinjaTrader application on a different PC

 

 

Note: The NinjaScript Archive File (.zip) generated through this process is compatible with both 32-bit and 64-bit versions of NinjaTrader.

Distribution_1

tog_minusExporting NinjaScript Indicators or Strategies as Assembly

You may want to provide other NinjaTrader users with access to your proprietary indicators or strategies in a secure format preventing them from being able to see your proprietary source code. You can do this by exporting your NinjaScript indicators as a compiled Microsoft .NET assembly (DLL) file.

 

This is a great distribution option if your proprietary indicator or strategy files do not reference external DLL's
If your proprietary indicator or strategy references external DLL's then its advised to create your own custom installer

 

1.From the Control Center window select the menu File > Utilities > Export NinjaScript to open the "Export NinjaScript" dialog window
2.Select the option "Export compiled assembly of selected source files".
3.You can optionally select "Protect compiled assemblies" (For information on protection see the "Protection/DLL Security page)
4.Enter a user defined file name
5.Select all of the files that you want to export and either double click on them or press the ">" button
6.A list of all files that will be exported
7.Optionally enter information that describes the assembly
8.Press the "Export" button to export the selected files
9.A NinjaScript Archive File (.zip) file will be created in My Documents\<NinjaTrader Folder>\bin\Custom\ExportNinjaScript
10.The file can be imported by another NinjaTrader application on a different PC

 

Note: When exporting a protected assembly the generated .zip will contain a x86 (32-bit) and x64 (64-bit) version of the DLLs. When a user installs this .zip, both assemblies are installed and NinjaTrader will automatically load the correct one based on if the user is in 32-bit or 64-bit mode.

Distribution_2

tog_minusExporting NinjaScript Indicators or Strategies for use in both NinjaTrader 6.5 and 7

Should you wish to create one script file that can be used in both NinjaTrader 6.5 and 7 instead of having one version for 6.5 and another for 7 you can use the following pre-compiler directive to tag NinjaTrader 7 specific code. When the script is compiled in 7, it will compile any lines within the tag. When 6.5 is used, the 7 specific code will be ignored when compiling.

 

Syntax

#if NT7

 

Examples

protected override void Initialize()
{

    // When NT7 is used to compile this script, it will compile with the following line. When NT6.5 is used, the line will be ignored when compiling.

    #if NT7

    MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
    #endif
}