Buy Sell Volume NinjaScript
This Buy Sell Volume NinjaScript will return the total volume per bar, split into buy and sell market orders. The buy/sell volume indicator included with NninjaTrader is coded in a way that makes it incompatible with backtesting in Market Replay – ours isn’t.
This download contains the .cs code for our Buy Sell Volume NinjaScript. This strategy will return the total volume per bar, split into buy and sell market orders. The buy sell volume indicator included with NninjaTrader is calculated in a way that makes it incompatible with backtesting in Market Replay. Our version can be backtested with Replay data. The buy/sell volume data from the default NinjaTrader indicator sometimes returns inaccurate numbers, and we've fixed that as well in our Buy Sell Volume NinjaScript.
If you want to access the current bar’s buy/sell volume, your strategy’s calculate mode must be set to Calculate. OnEachTick. Otherwise, you can only access the current bar’s volume after it closes (at which point it will be 1 bar ago). If you want it both ways, you can add a second data series to set the time frame you want to use for determining buy sell volume. You can do that with our Free Secondary Series NinjaScript.
A buy is a transaction at the ask price or above. A sell is a transaction at the bid price or below. Basically these are market orders. Since market orders are “active” (i.e. I want to get in the market right now), and limit orders are passive (i.e. I’ll enter the market only at my desired price, and I may or may not get a fill), a large discrepancy between buys and sells can indicate something about market sentiment. The following image is what the code prints out by default as a basic example of how you can handle the buy sell data.
If you'd like to use this as an indicator instead of a strategy in NinjaTrader, you can download our Buy Sell Volume Imbalance Indicator. The indicator will add a visual element to your charts, and it's properties are also accessible if you want to call it up in a custom strategy.
Possible use case
If you see over the last five 1-minute bars that the total number of buys is 20% greater than the total number of sells, go long. Strengthen this entry signal by combining it with other signals as an entry filter. This example entry method comes with the C# strategy code in this download.
This 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?
I tried downloading this after purchase… it it says “page not found”
Same here. I purchased some indicators a few months back and came here to download again.It says “page not found”. The support email you provided also bounces back.