Installing NinjaTrader Indicators and Strategies

It is only when they go wrong that machines remind you how powerful they are.

Clive James

CtrlAltDaveLargeIn the modern world, you need various platforms, tools and systems to enable you to trade efficiently and successfully. Professional traders in Investments Banks have surprisingly large technical support teams, but even they still must have a general understanding and appreciation to use the tools well, and to realise what they want in future versions. It is a wise plan not to rely on technical support because it is much slower than already knowing the answer yourself, and many are inept anyway.

Import NinjaTrader Indicators or Strategies using the Official Method

  1. Download the attached file to your desktop but do not unzip the zip file.
  2. Using NinjaTrader’s Control Center window, select File > Utilities > Import NinjaScript.
  3. Select the downloaded file.
  4. If successful, all contained Indicators and Strategies will be immediately available for use.

Remove compiled NinjaTrader Indicators or Strategies using the Official Method

  1. Using NinjaTrader’s Control Center window, select File > Utilities > Remove NinjaScript Assembly.
  2. Select the unwanted item and click Remove.

Remove non-compiled NinjaTrader Indicators or Strategies using the Official Method

  1. Using NinjaTrader’s Control Center window, select Tools > Edit NinjaScript > Indicator ( or Strategy ).
  2. Select the unwanted item and click Remove.

If this fails, there may be already errors with existing scripts. Open any standard indicator, like @EMA by using NinjaTrader’s Control Center window, Tools > Edit NinjaScript > Indicator and press F5 to compile the script. This will show any errors with all existing NinjaScript, not just @EMA. the errors will prevent you from installing anything else, these issues therefore have to be resolved before you can continue.

Behind the scenes, the programming environment of NinjaTrader is actually quite complex which it tries to hide to help ease of use. Sadly, sometimes it gets confused, most notably about the dependency of user scripts on each other and thus the above official methods will fail.

The official method places the contents of the Zip file in the required directories and adds the dependency with the additional benefit of not requiring a NinjaTrader restart. You can manually copy the files yourself if you have Administrator rights over the computer.

  • Files with extension .cs

Open source scripts, which can be freely edited by NinjaTrader’s Edit NinjaScript command, or any text editor. They need compiling to be available for use.

  • Files with extension .dll

Protected libraries containing precompiled indicators and/or strategies or third party support libraries which add functionality for use by NinjaScript, for example custom logging (http://logging.apache.org/log4net). They are encrypted to allow their use, but do not give away any Intellectual Property of how they work.

  • Files with extension .zip

A compressed file packaging any number of indicators and/or strategies, together with required third party support libraries.

  • C:\Documents and Settings\<UserName>\My Documents\NinjaTrader 7

The full pathname of the default installation directory of NinjaTrader, using your Windows Login account name.

  • NinjaTrader 7\bin\Custom

Contains the compiled scripts and third party libraries. All .dll files live here.

  • NinjaTrader 7\bin\Custom\Indicator
  • NinjaTrader 7\bin\Custom\Strategy

Contains the open source scripts. All .cs files should be placed in their directory corresponding to their type.

  • NinjaTrader 7\templates\Indicator
  • NinjaTrader 7\templates\Strategy

The location of saved default values.

  • NinjaTrader 7\bin\Custom\NinjaTrader.Custom.dll
  • NinjaTrader 7\bin\Custom\NinjaTrader.Custom.xml

NinjaTrader maintains a list of all known indicators and strategies.

  • NinjaTrader 7\trace

The trace directory contains dated logs filled with extra information about NinjaTrader’s activity including any errors although the contents is generally aimed at developers. Reading the latest log may give extra clues on any problems.

Import NinjaTrader Indicators or Strategies using the Manual Method

  1. Download the attached file to your desktop but, this time, unzip the zip file. Modern versions of Windows natively supports such action, otherwise consider getting WinRar (www.winrar.com).
  2. Stop NinjaTrader.
  3. File copy the contents of the zip file.  Place all .dll files to NinjaTrader 7\bin\Custom, all .cs files that are Indicators to NinjaTrader 7\bin\Custom\Indicator and all .cs files that are Strategies to NinjaTrader 7\bin\Custom\Strategy.
  4. Move the NinjaTrader.Custom files to somewhere safe outside of NinjaTrader’s directory.  They can be found at NinjaTrader 7\bin\Custom\NinjaTrader.Custom.dll and NinjaTrader 7\bin\Custom\NinjaTrader.Custom.xml.  NinjaTrader will be forced to regenerate them. It is unwise to simply delete them, in case, they are not regenerated correctly.
  5. Start NinjaTrader.
  6. Open any indicator, like the standard @EMA by using NinjaTrader’s Control Center window, Tools > Edit NinjaScript > Indicator. Right click on the script, and select the last option, “References…”. Click “Add” to select any .dll files that you manually copied in the earlier step.
  7. Hit F5 to compile the NinjaScript. Note that it compiles all NinjaScript, not just the single indicator that is currently displaying.
  8. If successful, the new Indicators and/or Strategies will be available for use.

Remove compiled NinjaTrader Indicators or Strategies using the Manual Method

  1. Stop NinjaTrader.
  2. Move any unwanted files to somewhere safe outside of NinjaTrader’s directory.  Depending on the type of unwanted item, they will exist under NinjaTrader 7\bin\Custom.
  3. Move the NinjaTrader.Custom files to somewhere safe outside of NinjaTrader’s directory.  They can be found at NinjaTrader 7\bin\Custom\NinjaTrader.Custom.dll and NinjaTrader 7\bin\Custom\NinjaTrader.Custom.xml.  NinjaTrader will be forced to regenerate them. It is unwise to simply delete them, in case, they are not regenerated correctly.
  4. Delete the default values for the unwanted items, from the NinjaTrader 7\templates directory. Otherwise, if you later install a newer version, but it has different parameters, then NinjaTrader will complain.
  5. Start NinjaTrader.
  6. Open any indicator, like the standard @EMA by using NinjaTrader’s Control Center window, Tools > Edit NinjaScript > Indicator. Right click on the script, and select the last option, “References…”. Select any .dll files that you deleted in the earlier step, and click “Delete”.
  7. Compile the NinjaScript by hitting F5. Note that it compiles all NinjaScript, not just the single indicator that is currently displaying.  If successful with no error message, any unwanted NinjaScript is no longer available.

No installation guide would be complete without some jibber-jabber on making backups of your files. It is painfully dull and appears to be like a waste of time compared to anything else that you could be doing, like actually making money by trading. However, while moving or deleting files, accidents can happen as well as hardware failures. If it helps, consider the trade of losing your Holy Grail strategy with unknown likelihood compared to the time taken to copy some files around. Ensure that you keep this copy outside of the NinjaTrader directories otherwise NinjaTrader will try to load it and get confused. Alternatively, ask the NSA for their copy of your work.

Posted in Development, tagged with on