> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Orderflow: buying, selling and delta

> The orderflow series for trade counts, buy and sell volume and delta, and the cumulative volume delta function.

The `orderflow` namespace gives each bar's trade counts and buying and selling volume, from the bar's footprint data (its trades grouped by price and by buy or sell side). All ten values and the one function are series ints.

| Name | Value for the bar |
| - | - |
| `orderflow.trades` | All trades. |
| `orderflow.buy`, `orderflow.sell` | Number of buy trades, number of sell trades (counts, not volume). |
| `orderflow.buyvolume`, `orderflow.sellvolume` | Volume bought, volume sold. |
| `orderflow.delta` | Delta at the bar's close: buy volume minus sell volume. |
| `orderflow.maxdelta`, `orderflow.mindelta` | Highest and lowest delta reached while the bar formed. |
| `orderflow.cothigh`, `orderflow.cotlow` | Net buying (buy minus sell volume) since the bar last traded at its high, and at its low. |
| `orderflow.cvd()` | Cumulative delta: each bar's `orderflow.delta` added to a running total that restarts from 0 on the first bar of every session (`session.isfirst`). A bar whose delta is `na` leaves the total unchanged. It takes no arguments. |

`orderflow.*` values exist only on bars with footprint data. A bar without it has all ten as `na`; no value carries over from an earlier bar. So a script can test `na(orderflow.delta)` and run on every instrument (see [Data availability by market](https://gocharting.com/docs/scripting/market-data/availability.md)).

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Delta and session cumulative delta")
plot(orderflow.delta, title="Delta", style=plotStyle.histogram, color=orderflow.delta >= 0 ? color.green : color.red)
plot(orderflow.cvd(), title="Session CVD")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.