The two sides of a trade tick: aggressor.buy for a buyer lifting the ask and aggressor.sell for a seller hitting the bid.
aggressor.buy and aggressor.sell are int constants to compare with aggressor_side, the series variable that reports which side started a trade. aggressor.buy is a buyer taking the offer, and aggressor.sell is a seller taking the bid.
They are available in Pine v6 only, and the data behind them is tick-level, so they matter for volume-delta and footprint-style scripts.
Constants
| Name | Value | Description |
|---|---|---|
aggressor.buy | A trade started by a buyer taking the offer. | |
aggressor.sell | A trade started by a seller taking the bid. |
Remarks
- Compare with == rather than relying on the numeric value of the constants.
- On Sidechair: aggressor_side and these constants are not supported yet.
Example
//@version=6
indicator("Aggressor")
var float buys = 0.0
var float sells = 0.0
if aggressor_side == aggressor.buy
buys += 1
else if aggressor_side == aggressor.sell
sells += 1
plot(buys - sells, "Delta", color.blue)See also
Not on Sidechair yet