Wednesday, April 2, 2014

Blank NinjaTrader Instrument Database

If I remember correctly, NinjaTrader is pre-loaded with the definitions for about 17k instruments which are mainly stocks, futures and currency pairs for the US markets. I am running NinjaTrader in a VM environment. Sometimes the Instrument Manager will freeze momentarily when I add or remove an instrument. Since my focus has always been on Malaysian instruments, I embarked on a mission to get rid of all the pre-loaded instruments irrelevant to me.

If you have all the time in the world, you can delete each and every instrument one at a time in the Instrument Manager. It is a shame we cannot select multiple instruments for deletion. If you have some basic knowledge of SQL, a faster way to remove unwanted instruments is to update the NinjaTrader database directly.

NinjaTrader 7 Database Path:
C:\Users\{username}\Documents\NinjaTrader 7\db\NinjaTrader.sdf 

I will not go into details how I purged the database. If you would like to build your own instruments database from scratch, you may download the blank [1] NinjaTrader database file here [2]. Simply replace the file in the above-mentioned path and you are good to go.


---
  1. The database is not really blank. It still contains the instrument definitions for the major currency pairs.
  2. Download blank NinjaTrader Instrument Database.

The VOL (Volume) Indicator

All indicators in NinjaTrader will not plot the first 20-bar data. There is no exception whatsoever even though what the indicator might do is just plotting the input data as is. The VOL is one such indicator which plots the volume data without any sophisticated calculations. It is quite off-putting for a newbie like me when the basic VOL indicator "does not" work the way I've been accustomed to.


The "fix" is easy and it only requires one additional line in the VOL indicator source file [1].

protected override void Initialize()
{
BarsRequired = 0;
Add(new Plot(new Pen(Color.Blue, 2), PlotStyle.Bar, "Volume"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
}

Even though the "fix" is a one-liner change, it has not been incorporated into the latest NinjaTrader release, i.e. v.7.0.1000.22. Hence, one will have to manually update and re-compile the indicator. Since one cannot save changes made to system indicators from within NinjaTrader, I would suggest one to edit and save the indicator using any text editors. Indicator source files are located in C:\Users\{username}\Documents\NinjaTrader 7\bin\Custom\Indicator.


---
  1. Reference: NinjaTrader Support Forum.