Distribution Procedure
Previous Topic  Next Topic 

You must first determine if our standard "Export" feature is sufficient for distribution purposes or if you need to create your own custom installer.


If...



Then we suggest exporting your indicators or strategies as an assembly using our standard export feature. Otherwise follow the instructions below for correct distribution.




Distributing Custom Indicators

NinjaTrader makes it easy for consumers of your custom indicators to use your indicators within their own custom indicators and/or strategies. To make this possible, the NinjaScript Editor automatically generates the required code to make this happen. If you have developed your custom indicator within the NinjaScript Editor you can skip over this section however, if you have developed outside of the NinjaScript Editor, it is important that you follow these instructions.


1. Transfer your code to the NinjaScript Editor and save the file

2. During either the save or compile process, code is generated in a new region in your indicator file as per the image below






Vendor File

A vendor file is only releveant for distribution of custom indicators. You can skip over this is you are distributing a strategy. In order to allow your custom indicators to be called as a method from within a users custom indicator or strategy it is necessary to create a vendor file. Please name this file "NinjaTrader.YourName.cs". The contents of this file contain program code (partial classes) that make your indicator methods available to your users. This additional code acts as a wrapper and only enables your indicators to be used within other indicators and strategies and DOES NOT EXPOSE ANY OF YOUR PROPRIETARY PROGRAMMMING CODE.


To create a vendor file follow these steps:


See the file: "Program Files\<NinjaTrader Folder>\bin\Backup\NinjaTrader.Vendor.cs file for reference sample.


1. Open Microsoft Notepad or any other text editor

2. Copy the code from Figure 1 below into the text editor

3. Open each one of your custom indicators and copy the NinjaScript generated code within the region "NinjaScript generated code. Neither change nor remove." to the text editor.

4. Save this file as "NinjaTrader.YourCompanyName.cs" where "YourName" is the name of your company or product as per the naming conventions section.



Figure 1

#region Using declarations

using System;

using System.ComponentModel;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Xml.Serialization;

using NinjaTrader.Data;

using NinjaTrader.Gui.Chart;

#endregion



Creating a Compiled .NET Assembly (DLL)

You should distribute your proprietary indicator or strategy files as a compiled .NET assembly (DLL) which does not expose your proprietary programming code. To safeguard against decompilation or reverse engineering, you can add additional layers of security to protect your intellectual property through 3rd party tools.


From within the folders:


My Documents\<NinjaTrader Folder>\bin\Custom\Indicator

My Documents\<NinjaTrader Folder>\bin\Custom\Strategy

My Documents\<NinjaTrader Folder>\bin\Custom\MarketAnalyzer


1. Temporarily remove any irrelevant .cs files that are not required for the custom assembly you wish to distribute with the exception of any system .cs files which are marked with a "@" prefix

2. Open any indicator or strategy compile it which will create a new assembly (DLL) that contains only the relevant indicators, strategies and Market Analyzer columns

3. Make a copy of the file "My Documents\<NinjaTrader Folder>\bin\Custom\NinjaTrader.Custom.dll" and rename it (myCustomObject.dll for example)


You now have created your DLL.




Distribution of your Assembly

You should now have the following



If you are distributing Indicators you should also have the following:




These files need to be saved on the end users PC in the following folder:


My Documents\<NinjaTrader Folder>\bin\Custom


You can either create a custom installer that installs these files on the user PC or provide them with instructions to receive and save the files in the folder specified above.


Critical: It is important to let your customers know that NinjaTrader Version 6 indicators and strategies are NOT compatible with NinjaTrader Version 5.




Using 3rd Party Indicators in a Custom Indicator or Strategy

Once your custom indicators are installed on the user's PC, please let them know that in order to access the methods contained in your custom DLL they must add a reference to this DLL via the NinjaScript Editor right mouse click context menu, sub menu "References" and then add your custom DLL as a reference. This only needs to be done once since adding a reference to your DLL is via the NinjaScript Editor is a global setting. See the section Developing Strategies > "Using 3rd Party Indicators".