Order Book NinjaScript

$10.00

This Order Book NinjaScript will create a level 2 book that is accurate to the millisecond. You can access the volume of every bid and ask orders on the level 2 order book for all 10 price levels.

Overview

This download contains the .cs code for our Order Book NinjaScript. This strategy NinjaScript will create a level 2 book that is accurate to the millisecond. You can access the volume of every bid and ask orders on the level 2 order book for all 10 price levels.

This NinjaScript add-on is not assembled which means you have full access to view and change the source code either in NinjaScript Editor or your preferred way to edit .cs files.

Our Order Book NinjaScript has many possibilities for high frequency trading, order flow trading, and automated trading. An example use case would be: enter a long position when the number of all pending orders on the bid side outnumbers the number of all pending orders on the ask side. The example image on this page shows the data you’ll have access to programmatically. With this information you can explore in countless directions in your strategies.

Order Book NinjaScript Output

The Order Book NinjaScript is the framework that our Order Book Imbalance Indicator is built on. This indicator displays the difference in the quantity all orders on the bid side of the order book and the quantity of all orders on the ask side. A great imbalance between the bid and ask side can imply a higher probability of the market moving up with bid pressure or down with ask pressure.

Possible use case

Add this to an existing entry signal as a filter to only enter long when the total bid book volume is 20% greater than the total ask book volume, as this could indicate that the path upward has less resistance than the path downward. This example entry method comes with the code.

Notes

This Order Book NinjaScript add-on is a single zip file that you import directly into NinjaTrader. It’s not assembled which means you have full access to view and change the source code either in NinjaScript Editor or your preferred way to edit .cs files.

This code will not work with releases prior to NinjaTrader 8.

Got something to discuss?


Guest
Guido
4 years 9 days ago

Hi
very interesting work!
when you add each level volume can you also associate to them a weight inversely proportional to on their distances from the current price ? I saw some examples on TT aADL which were doing that.
Can you show one or more practical examples on how you can use this data with a NT8 strategy ?
Thanks

Support
Support
4 years 9 days ago

Thanks!
The weighting would be very easy to do. It would be something like this (you could change the numbers if you don’t want linear weighting):
(bid volume at position 0) * 1
(bid volume at position 1) * .9
(bid volume at position 2) * .8
(bid volume at position 3) * .7
etc.

One practical use would to add this to an existing entry signal of your own as a filter to only enter long when the total bid book volume is double the total ask book volume, as this could indicate that the path upward has less resistance than the path downward.

I’ll add both of these to the freemium section today.

EDIT: I’ve added the weighted order book to the freemium section, and the entry filter I mentioned above is now incorporated into the core strategy itself in the premium section.

Guest
Alex
2 years 2 months ago

more photo, thanks

Customer
Jason Storm
1 year 7 months ago

hey folks, i installed this on NT8 64b windows and enabled it as a strategy but im not seeing an orderbook window as shown above, please advise?