How-to import indicators in NinjaTrader - futures io
futures io

How-to import indicators in NinjaTrader

Process for importing an indicator into NinjaTrader:

Open any custom indicator with Tools > edit NinjaScript and press F5, see if there are any errors, before trying to import any new indicator.

There are at least 4 ways to "load" a new (or updated) indicator.
  1. Use the import utility (does not always work for a bunch of reasons)
  2. Create a new indicator and paste the XYZ.cs file into it from notepad
  3. Open an existing indicator (with the same name ) and paste over it, again from notepad.
  4. Copy XYZ.cs to your "Documents\NinjaTrader 7\bin\Custom\Indicator" folder


[top]Using the built-in NinjaTrader Import Utility
  • Save the NinjaTrader zip archive somewhere accessible, like on your Desktop.
  • Load NinaTrader Control Center. Go to File - Import.
  • Select the zip file and press OK. Remember, don't unzip the file.
  • If it works, you'll get an OK message and the indicator will now be in your available indicators list.
[top]Import an indicator brute force: (if the normal way doesn't work)
Sometimes brute force is needed to get around NinjaTrader problems.
  • Open the indicator zip file manually and click on the file name, then indicator & finally open the indicator XYZ.cs file in Notepad.
  • In NT create a new indicator Tools > New NinjaScript > Indicator, with the name you find in the .cs file
  • In notepad select all. In the newly created indicator file select all, delete everything in the newly created indicator and paste the notepad code in its place. Press the F5, key see if you get any errors. IF NO you are done.
  • Sometimes there are called indicators: like @EMA, @MacD @StdDev - the @ means they are built into NinjaTrader. So you can skip this step (no need to import these).
  • If the indicator calls other custom indicators they would have to be added to the indicator directory by pasting into MyDocuments>NinjaTrader(6.5 or 7, whatever you have)>bin >Custom>Indicator. Then F5 again and it should work.
[top]Copy XYZ.cs to your "Documents\NinjaTrader 7\bin\Custom\Indicator" folder then compile it
This approach assumes your version of NT (what your licensed for) allows you to compile files via the user interface. All the Zip utility does is "extract" the contents of the Zip file in the required folder and then compile the file. If you understand the folder structure of windows, you can manually copy and paste the files there yourself and then manually compile. Typically you find just a single XYZ.cs (c sharp source code file) file listed in the zip file, you can simply copy that file (drag and drop works just fine) to your "Documents\NinjaTrader 7\bin\Custom\Indicator" folder. If you have more than just a single .cs file in the Zip file, chances are all the others begin with an @ sign. (copy the ones you do not have). The files that begin with an @ sign are the default indicators provided by Ninja. You do not need to copy those if you already have them in your "Documents\NinjaTrader 7\bin\Custom\Indicator" folder. If the Zip files has .dll files, the content gets stored back one folder. ( If your asking what that means, don't install Zip files with .dll files, use the NT supplied utility to do so. ) When the required .cs file is in the listed folder, go into NT Control Center Tools->Edit->Indicator and from the listings dialog find the new .cs file. Click on it to open, then press F5 to compile it. Once compiled you will see it listed available for use in the Add Indicator dialog.
[top]How to Delete an indicator Cleanly if you run into problems importing it

To cleanly delete an indicator having issues, go to Control Center Tools->Edit->Indicator. Now read the names of the buttons on the bottom of the dialog that pops up. To delete an indicator, highlight it in the listing, then press the Delete button. Simply deleting if from the indicator folder does not remove the internal configurations and actually causes more issues. Using the approach listed above to delete an indicator both deletes it from the folder and clears the internal configuration.

If a single indicator has compile errors, any subsequent attempt to compile, even a completely different indicator, will fail, reporting the errors from the previous indicator. This is a feature of object orientated programming - you inherit the functionality of others work and in the case you inherit the errors. For simplicity sake do not keep indicators with compile errors - either fix the errors or delete the indicator using the above method.
[top]Resolving import errors by looking at the trace file
After using the brute force method, hit F5 and you will know if it worked, as there are no errors. If you do get errors, try to remove the conflicting indicator. Can be done using the trace file.

  • Just go to OwnDocuments -> NínjaTrader (7) -> trace, and open the trace file of today with the text editor. Read the tracefile and it will tell you, which was the offensive indicator.
  • Start Ninjatrader, then edit the offensive indicator and delete it. Problem should be solved now.
  • Always make a backup copy before you delete something. Back it up somewhere else, it can't stay in the Indicators directory or NinjaTrader will try to load it again.

It should work, but sometimes it does not then you need to do it by hand. It can be a lot of work. As you have to do it for each XYZ.cs you want to add.
[top]Installing the Speech DLL
To use any indicators that have voice capability, the "System.Speech.dll" reference may need to be added to NinjaTrader. To do this:
  1. Open any Indicator/Strategy in the editor
  2. Right Click in the Editor Window
  3. Select "References..."
  4. Click "Add"
  5. Addl the following file "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Speech.dll"
[top]Resolving Duplicate Method Error when importing into NT7
The following steps will fix the duplicate method error received when importing a new indicator into NT7.

  1. Open up the zip file of the indicator your trying to import.
  2. Open up the indicator folder inside the zip file
  3. Take note of all the indicators names within the folder.

  1. Navigate to your documents folder on your c drive
  2. Once in there find the Ninja Trader7 folder and find the indicator folder. The path should look something like this: Documents\NinjaTrader 7\bin\Custom\Indicator
  3. Refer back to step 1 and find all the indicators located in the zip file. They will be named exactly the same. I would suggest cutting them (dont copy) and placing them into a folder on your desktop or somewhere else on your computer. This way if something goes wrong you can move them back to their original place.
  4. Close ninja trader and re-open. Then import indicator again. Everything should now import correctly.
[top]Additional Information
ZTR has complained to NT Support about the fact that @indy's (built in from NT) fix the problem you are having automatically, but custom ones do not and then it is a lot of work to straighten things out.

Attached Thumbnails
Click image for larger version

Name:	Duplicate error.png
Views:	6179
Size:	9.3 KB
ID:	123369  
Contributors:  Silver Dragon ,  NJAMC ,  tulanch ,  Big Mike ,  ZTR 

Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada),
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.