NinjaScript > Educational Resources > Tips >

Best Practices for 3rd Party Developers

Print this Topic Previous pageReturn to chapter overviewNext page

The following are what we suggest for best practices.


Do not deploy NinjaScript Source Files

If you are a commercial vendor, you should never distribute the NinjaScript .cs source code files even if your IP is contained within an assembly or proprietary DLL. Source code files are editable by users and can result in unnecessary support issues.


Naming Conventions

Please use consistent naming convention with your indicators and strategies. We suggest adding a prefix to an indicator name. If your company name is "Hyper" you could name your indicators "HyperTrend" or "HyperOscillator" for example.


In the event that you provide NinjaScript export archives (zip files) as your means of distribution, NinjaTrader 7 will automatically block incompatible scripts from importing so there will be no confusion by the user as to whether they are installing 6.5 or 7 scripts to their NinjaTrader installation. It is advisable to include the NinjaTrader version number in the export archive which will reduce potential support burden. For example, you could name your indicators “” and “”.


Clean up your resources

Always free up resources such as external windows DLL's or license management related resources. Resources should be freed within the OnTermination() method. NinjaTrader calls this method as an indicator or strategy is no longer used.


User Authentication Trigger

If you have proprietary user authentication process ensure that it is triggered within the OnStartUp() method. This ensures that users are not forced to endure unnecessary delays on NinjaTrader start up or dialog windows that display available indicators and strategies are loaded. NinjaTrader, LLC provides a free licensing service for qualified 3rd party developers.


User Authentication Check State

A license check should only be performed once and maintain its check state.


User Authentication Time Out

A license check should have a time out in case of internet issues. This ensures that NinjaTrader does not lock up.


Custom Installer

If you provide a custom installer, the installer should not overwrite any NinjaTrader deployed files (such as UserDefinedMethods.cs) and you should provide an uninstall option which removes all installed files.


It is also preferred that you provide one installer that provides the user the option to install either a version 6.5 or version 7 compatible version of your product(s). Ensure that you only copy the correct files to the correct NinjaTrader installation folders since if you don’t it is possible that it could cause compile issues for the customer and it will be extremely difficult for all involved to isolate the cause.


These are the following folder names:

Documents\NinjaTrader 6.5\bin\Custom

Documents\NinjaTrader 7\bin\Custom


Test on Windows XP, Vista, 7 and 2000

NinjaTrader customers run on XP, Vista, 7 and 2000 and you should make sure that your indicators, custom installers and external DLLs (if any are used) properly run on all operating systems.


Expose Indicator States

If your proprietary indicator acts as a trend state (green bars are bullish, red bearish) its good practice to expose the indicators's state so that consumers of your indicators can use them within their own custom indicator or strategy.