> ## 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 variables

> Reference for the 10 variables of the orderflow namespace: orderflow.buy, orderflow.buyvolume, orderflow.cothigh, orderflow.cotlow and 6 more, each with its definition and an example.

> [!NOTE]
>
> Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: orderflow · Entries: 10

## `orderflow.buy` (variable)

**Definition**

How many buy trades the bar carried.

This counts trades, not volume. `orderflow.buyvolume` measures the volume those trades moved, and the two are separate figures rather than two views of one.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Buy Trades per Bar", overlay=false)
buyTrades = orderflow.buy
plot(buyTrades, title="Buy Trades", style=plotStyle.histogram, color=color.green)
```

## `orderflow.buyvolume` (variable)

**Definition**

The volume bought in the bar.

A bar can carry more buy trades than sell trades while more volume goes the other way, so pick the count or the volume according to the question.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Buy Volume per Bar", overlay=false)
buyVol = orderflow.buyvolume
plot(buyVol, title="Buy Volume", style=plotStyle.histogram, color=color.green)
```

## `orderflow.cothigh` (variable)

**Definition**

The commitment-of-traders high for the bar, taken from the same per-bar footprint summary as the delta figures.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("orderflow.cothigh Example", overlay=true)
coth = orderflow.cothigh
plot(coth, title="COTH", color=color.red, style=plotStyle.line)
```

## `orderflow.cotlow` (variable)

**Definition**

The commitment-of-traders low for the bar.

The summary these two come from also holds a buy and a sell breakdown of each. Lipi does not expose those, so the high and the low are all a script can read.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("orderflow.cotlow Example", overlay=true)
cotl = orderflow.cotlow
plot(cotl, title="COTL", color=color.blue, style=plotStyle.line)
```

## `orderflow.delta` (variable)

**Definition**

The bar's delta as at its close.

For the delta accumulated across a session rather than one bar's figure, call `orderflow.cvd()`.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Orderflow Delta", overlay=false)
delta = orderflow.delta
plot(delta, title="Delta", style=plotStyle.histogram, color=delta >= 0 ? color.green : color.red)
```

## `orderflow.maxdelta` (variable)

**Definition**

The highest delta the bar reached while it was forming.

It belongs to that bar alone and starts afresh on the next one, so it is not a running high across the chart.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Max Delta per Bar", overlay=false)
maxDelta = orderflow.maxdelta
plot(maxDelta, title="Max Delta", style=plotStyle.histogram, color=color.green)
```

## `orderflow.mindelta` (variable)

**Definition**

The lowest delta the bar reached while it was forming.

Read it with `orderflow.maxdelta` when you want the swing inside a bar: a bar can close near zero having travelled a long way in both directions, and the closing figure will not show that.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Min Delta per Bar", overlay=false)
minDelta = orderflow.mindelta
plot(minDelta, title="Min Delta", style=plotStyle.histogram, color=color.red)
```

## `orderflow.sell` (variable)

**Definition**

How many sell trades the bar carried.

The mirror of `orderflow.buy`, and a count in the same way.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Sell Trades per Bar", overlay=false)
sellTrades = orderflow.sell
plot(sellTrades, title="Sell Trades", style=plotStyle.histogram, color=color.red)
```

## `orderflow.sellvolume` (variable)

**Definition**

The volume sold in the bar.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Sell Volume per Bar", overlay=false)
sellVol = orderflow.sellvolume
plot(sellVol, title="Sell Volume", style=plotStyle.histogram, color=color.red)
```

## `orderflow.trades` (variable)

**Definition**

The bar's overall trade count.

It is read from the bar's own footprint totals, not worked out by adding the buy and sell counts together.

**Type**

`series int`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Total Trades per Bar", overlay=false)
totalTrades = orderflow.trades
plot(totalTrades, title="Total Trades", style=plotStyle.histogram, color=color.gray)
```


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