Trade Testing Environment and Setup
This article will cover all the basic setup needed in order to follow along with any of my notes or tutorials.
This section will be updated as changes are made. It will cover installing the basics and reference any additional articles needed for in-depth review/instruction.
Working with a NinjaScript project is pretty straightforward. You can technically write NinjaScript classes inside of NinjaTrader 8 (NT8) with the built-in editor, but this isn't the best solution in most scenarios.
NinjaScript Environment
NinjaScript is a C# based language that allows users to extend the functionality of the NinjaTrader platform.1
The skill of the developer appears to be the limit when it comes to what is capable with C# and NinjaScript. You can use many different .NET and core C# functionalities within a NinjaScript class and as such it is better to develop them inside of a proper environment, like Visual Studio. Which also happens to be free. There are other IDEs that you can use to work with NinjaScript but I will be using Visual Studio for everything until there is a good enough reason not to.
Installing Visual Studio
Go to Microsoft and download the latest community version of Visual Studio (currently 2022).
Once downloaded, click on the file and install. For detailed instruction on installing Visual Studio refer to this documentation.
*Note: in my initial install I only chose the .NET desktop development workload. Anything else we need we should be able to install after the fact.
Creating the NinjaTrader Custom Solution File
Once installed, open visual studio and go to:
File --> Open --> Project/Solution
.
From there navigate to:
Documents/NinjaTrader 8/bin/Custom
Find:
NinjaTrader.Custom.csproj
Open it and save it as a solution file.
The example below shows the starting screen after loading the NinjaTrader.Custom.csproj
file and saving it as a solution. Subsequent loads you can open the NinjaTrader.Custom.sln
to get started.
Note, from here, anything that you add (files, folders) will be accessible within NT8. If not immediately available, you may need to open the NinjaScript Editor inside NT8 and press "Compile".
From here you can work on building custom addons, indicators, strategies, et cetera.
Alternatively, you can create new files inside the editor and then open them in Visual Studio by using the Visual Studio button in the Editor toolbar. When you save for the first time it will save it as a solution file.
Note: I experience an annoyance where Visual Studio will save a backup of files saves that were created outside of Visual Studio. When it does this it creates conflicting files inside of the NinjaTrader bin/custom folder and requires deletion of the `obj` and `bin` folders. This removes the conflict in NT8, but I haven't figured out why this happens yet or how to stop it.