Skip to content
All library documents

How Bar Direction Defines Net Volume and Its Limits

Article Quant Q&A · Author: Snifkes

Summary

The document distinguishes a common bar-based Net Volume indicator from trade direction. For each OHLCV bar, it assigns a positive sign when the close exceeds the open and a negative sign when the close is below the open, multiplies that sign by the bar’s volume, and cumulatively sums the signed amounts. Thus the reference for this version is the bar’s open, rather than the previous trade price. A table of five-minute bars illustrates how the running total changes as positive and negative bars arrive.

The result depends on the chosen bar interval, and the document suggests alternative direction rules based on VWAP changes or a threshold move. It also explains that a trade’s uptick or downtick, measured against the preceding trade price, does not necessarily match whether the trade was buyer- or seller-initiated. Reliable trade-side classification may require exchange-labeled data or order-level records, especially when multiple executions share a time or order. The source also includes a conflicting alternative definition based on executed buy and sell quantities, so the term “Net Volume” should be interpreted according to the data and convention being used.

Key ideas

  • In the described bar-based indicator, a bar is signed by comparing its close with its open.
  • Signed bar volume is the bar’s volume multiplied by its direction sign, and Net Volume accumulates these values.
  • The bar interval and direction rule can materially affect the indicator.
  • Price upticks and downticks do not directly identify buyer- or seller-initiated trades.
  • Trade-side analysis may require exchange classifications or order-level information.

Tags

Full text
# Net volume reference for uptick and downtick


# Net volume reference for uptick and downtick












I am new to finance and I have been looking at market data in terms of prices, volumes and net volumes. From what I have gathered:

Volume - number of transactions (buying-selling) throughout the specified time.

Net Volume - difference between the uptick and downtick during that time, which essentially, in the example shown in here means the difference between "downward" trades and "upward" trades.

So, given an example where in the same hour I have 900 volumes, and +500 net volume, this means that 200 volumes were downward trades and 700 were upward trades. My questions is, upward/downward relative to what? to the initially buying price or to the most recent transaction?

## Answer by Sergei Rodionov (score 2, accepted)

https://quant.stackexchange.com/a/61427

The classical Net Volume indicator operates on OHLCV bars, not on raw trades.

- Uptick is registered when the bar's close is higher than open

- Downtick is registered when the bar's close is lower than open

- Signed (directional) volume is positive on uptick, negative on downtick

- Net Volume is the cumulative sum of signed volumes

Let me illustrate the concept with an example using 5-minute bars.

```
| datetime |  open() | close() | tick | volume() | sign_volume | net_volume |
|----------|--------:|--------:|-----:|---------:|------------:|-----------:|
| 09:30:00 |   62.35 |   62.48 |    1 |    95611 |       95611 |      95611 |
| 09:35:00 |   62.42 |   62.97 |    1 |    50887 |       50887 |     146498 |
| 09:40:00 |   62.94 |   62.82 |   -1 |    45114 |      -45114 |     101384 |
| 09:45:00 |   62.90 |   62.30 |   -1 |    24267 |      -24267 |      77117 |
| 09:50:00 |   62.29 |   61.45 |   -1 |    72576 |      -72576 |       4541 |
| 09:55:00 |   61.45 |   61.43 |   -1 |    28622 |      -28622 |     -24081 |
| 10:00:00 |   61.48 |   61.98 |    1 |    28092 |       28092 |       4011 |
| 10:05:00 |   62.00 |   62.02 |    1 |    42849 |       42849 |      46860 |
```

The SQL query below fetches raw trades, calculates OHLCV bars, classifies the bars by price direction (`tick` column), and finally sums up signed volumes.

```
SELECT *, SUM(signed_volume) AS net_volume FROM (
SELECT symbol, datetime, open(), close(), 
  CASE 
    WHEN close()>open() THEN 1
    WHEN close()<open() THEN -1
    ELSE 0
  END AS tick,
  volume(), 
  tick*volume() AS signed_volume
FROM atsd_trade WHERE symbol = 'NTAP.US'
AND datetime BETWEEN '2021-02-26' AND '2021-02-27'
GROUP BY exchange, class, symbol, PERIOD(5 minute)
    ) WITH ROW_NUMBER(symbol ORDER BY datetime) > 0
```

Net Volume over OHLCV bars is sensitive to the bar period.

You can perhaps stabilize it by using vwap and/or by tightening the tick condition so that it takes a larger price move to cause a change in net volume.

```
    WHEN vwap()>prev_vwap THEN 1
    WHEN vwap()<prev_vwap THEN -1
    ELSE 0
```

```
    WHEN close()>open()*1.001 THEN 1
    WHEN close()<open()*0.999 THEN -1
    ELSE 0
```

Trade direction (buy or sell) is not part of Net Volume calculation. Also, it's not the same as the order direction. In limit order books, a transaction is classified as BUY when an incoming buy order is instantly matched with a standing sell order. If the incoming buy order is not matched, it is placed in the order book, and the trade will be classified as SELL when a later sell order takes it. In other words, as @user47399 mentioned, the trade direction == liquidity taker's order direction. During auctions, when the limit order book is not used, trade direction is based on order numbers as assigned by the exchange. Of the two participating auction orders, the trade direction is inferred from the later order. To correctly determine trade direction one needs access to full order log or to a trade feed where records are pre-classified by the exchange.

Buy trades can be downtick trades and sell trades can be uptick trades. In the example below BUY trade 3657601171 is a downtick, whereas SELL trade 3657602494 caused an uptick.

```
| datetime                   |  price | quantity | side | prev_price | tick |  trade_num |
|----------------------------|-------:|---------:|------|-----------:|-----:|-----------:|
| 2021-02-26 11:01:43.482121 | 35.251 |        1 | B    |            |    0 | 3657600807 |
| 2021-02-26 11:01:47.289811 | 35.243 |       90 | B    |     35.251 |   -1 | 3657601171 |
| 2021-02-26 11:01:47.289811 | 35.243 |       10 | B    |     35.243 |    0 | 3657601172 |
| 2021-02-26 11:01:51.535774 | 35.242 |       11 | B    |     35.243 |   -1 | 3657601628 |
| 2021-02-26 11:01:59.153104 | 35.270 |        1 | S    |     35.242 |    1 | 3657602494 |
| 2021-02-26 11:01:59.153104 | 35.260 |        1 | S    |     35.270 |   -1 | 3657602495 |
| 2021-02-26 11:01:59.153104 | 35.252 |       11 | S    |     35.260 |   -1 | 3657602496 |
| 2021-02-26 11:01:59.682744 | 35.252 |       79 | S    |     35.252 |    0 | 3657602528 |
| 2021-02-26 11:01:59.682744 | 35.252 |       21 | S    |     35.252 |    0 | 3657602529 |
```

```
SELECT * FROM (
SELECT datetime, price, quantity, side, LAG(price) AS prev_price, 
  CASE 
    WHEN price>prev_price THEN 1
    WHEN price<prev_price THEN -1
    ELSE 0
  END AS tick, trade_num
FROM atsd_trade WHERE symbol = '-- redacted
AND datetime BETWEEN '2021-02-26 11:01:40' AND '2021-02-26 11:02:00'
) --WHERE (side = 'B' AND tick = -1 OR side = 'S' AND tick = 1)
```

For meaningful results, Net Volume calculated over raw trades would need to group quantities by the exact trade time (and order number) so that simultaneous trades triggered by the same order are treated as one transaction.

For instance, how would you classify SELL trades 3657602494, 3657602495, 3657602496, all originated by the same SELL order and registered at the same time? I think it should be treated as an uptick of 13 lots.

## Answer by develarist (score 0)

https://quant.stackexchange.com/a/54611

Net volume is not relative to anything. It is just a tally (summation) of the quantity of executed buy orders (+1 per share bought) and executed sell orders (-1 per share sold). Net volume is not the value of transactions, that would be price multiplied by quantity.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.