To use MTAPI with NinjaTrader, you need to take a few steps to include the API .dll file in the project.
Before starting to work with NinjaTrader, follow the steps described here or here.
Next, you need to do the following:
• close NinjaTrader if running.
• open a downloaded archive from your account :
• the “Examples” folder contains the necessary files for the operation of the API.
• copy the “NinjaTrader 8” folder to your documents folder:
• run NinjaTrader.
Adding a Reference
• From within the NinjaScript Editor, right click on your mouse to bring up the context menu and select the sub-menu References… as per the image to the right.
• A References window will appear
• Press the “add” and select the MtApi2Net.Client.dll file
• You will see a reference to the MtApi2Net.Client.dll in the References window
• Press the OK button
You will now be able to access the API methods.
You can now compile scripts added to NinjaTrader by pressing the F5 button on your keyboard or by clicking the Compile button in the top menu. If the compilation was successful, you will see a new “Copier MT5-NT” menu item in the main menu under New.
Note! The “Copier MT5-NT” addon is written in NinjaTrader version 8.1.3. If you are using a version less than 8.1.2 you may need to make some changes to the add-on source code to successfully compile the scripts.